Permalink
Browse files

Merge pull request #46 from maxhollmann/master

Made Wikipedia::Page#summary more robust for pagese without text
  • Loading branch information...
2 parents b944c2f + 29d2fd8 commit 49558460763c5455fc20663cbf111ee45fbc14cb @pietromenna pietromenna committed on GitHub Nov 30, 2016
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/wikipedia/page.rb
@@ -7,7 +7,7 @@ def initialize(json)
end
def page
- @data['query']['pages'].values.first
+ @data['query']['pages'].values.first if @data['query']['pages']
end
def content
@@ -45,7 +45,7 @@ def text
end
def summary
- (page['extract'].split("=="))[0].strip if page['extract']
+ (page['extract'].split("=="))[0].strip if page['extract'] && page['extract'] != ''
end
def categories

0 comments on commit 4955846

Please sign in to comment.