Skip to content

Commit

Permalink
🐛 Fix query methods throwing NoMethodErrors.
Browse files Browse the repository at this point in the history
Unless statements are weird. I haven't been able to find sources to provide that document this, but from some testing it appears that || and && function *differently* in unless statements than if statements. 'unless false || true' and 'unless true || false' will not execute, but 'unless true && false' or 'unless false && true' will. I decided to simply break the break statement into two, because it is much more readable than 'break unless use_continuation && result.key?('continue')'. Many style guides support this, probably for both reasons I provided. cc @xbony2
  • Loading branch information
elifoster committed Aug 31, 2016
1 parent 70b159f commit 65b7e7d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/mediawiki/butt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ def query(params, base_return = [])
loop do
result = post(params)
yield(base_return, result['query']) if result.key?('query')
break unless @use_continuation || result.key?('continue')
break unless @use_continuation
break unless result.key?('continue')
continue = result['continue']
continue.each do |key, val|
params[key.to_sym] = val
Expand Down

0 comments on commit 65b7e7d

Please sign in to comment.