Class: Crags::Search::Country
- Defined in:
- lib/crags/search/country.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#interval ⇒ Object
readonly
Returns the value of attribute interval.
Attributes inherited from Search
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Country
constructor
A new instance of Country.
- #items ⇒ Object
- #locations ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Country
Returns a new instance of Country.
6 7 8 9 10 |
# File 'lib/crags/search/country.rb', line 6 def initialize(opts = {}) super @country = @opts[:country] @interval = @opts[:interval] end |
Instance Attribute Details
#country ⇒ Object (readonly)
Returns the value of attribute country.
4 5 6 |
# File 'lib/crags/search/country.rb', line 4 def country @country end |
#interval ⇒ Object (readonly)
Returns the value of attribute interval.
4 5 6 |
# File 'lib/crags/search/country.rb', line 4 def interval @interval end |
Instance Method Details
#items ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/crags/search/country.rb', line 16 def items combined_items = locations.collect do |loc| sleep(interval) search = Location.new(opts.merge(:location => loc)) search.items end combined_items.flatten end |
#locations ⇒ Object
12 13 14 |
# File 'lib/crags/search/country.rb', line 12 def locations country.locations end |