class Dronestream::Strike
Public Class Methods
all()
click to toggle source
# File lib/dronestream/strike.rb, line 20 def all response['strike'] end
in_country(country)
click to toggle source
# File lib/dronestream/strike.rb, line 24 def in_country(country) strike.keep_if { |strike| strike['country'] == country } self end
in_location(location)
click to toggle source
# File lib/dronestream/strike.rb, line 49 def in_location(location) strike.keep_if { |strike| strike['location'] == location } self end
in_town(town)
click to toggle source
# File lib/dronestream/strike.rb, line 39 def in_town(town) strike.keep_if { |strike| strike['town'] == town } self end
method_missing(name, *args, &block)
click to toggle source
Calls superclass method
# File lib/dronestream/strike.rb, line 69 def method_missing(name, *args, &block) return strike.send(name.to_sym, *args, &block) if strike.respond_to?(name.to_sym) super end
reset()
click to toggle source
# File lib/dronestream/strike.rb, line 16 def reset # for tests @strike = nil end
response()
click to toggle source
# File lib/dronestream/strike.rb, line 8 def response response = get '/data' end
strike()
click to toggle source
# File lib/dronestream/strike.rb, line 12 def strike @strike ||= all end
with_child_casualties()
click to toggle source
# File lib/dronestream/strike.rb, line 34 def with_child_casualties strike.keep_if { |strike| !strike['children'].to_i.zero? } self end
with_civilian_casualties()
click to toggle source
# File lib/dronestream/strike.rb, line 29 def with_civilian_casualties strike.keep_if { |strike| strike['civilians'].to_i != 0 } self end
with_injuries()
click to toggle source
# File lib/dronestream/strike.rb, line 44 def with_injuries strike.keep_if { |strike| strike['injuries'].length != 0 } self end
with_intended_target()
click to toggle source
# File lib/dronestream/strike.rb, line 64 def with_intended_target strike.keep_if { |strike| strike['target'].length != 0 } self end
with_max_deaths(integer)
click to toggle source
# File lib/dronestream/strike.rb, line 59 def with_max_deaths(integer) strike.keep_if { |strike| strike['deaths_max'].to_i <= integer } self end
with_min_deaths(integer)
click to toggle source
# File lib/dronestream/strike.rb, line 54 def with_min_deaths(integer) strike.keep_if { |strike| strike['deaths_min'].to_i >= integer } self end