Class: Windy::Collection
- Includes:
- Enumerable, Finders
- Defined in:
- lib/windy.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #create_record(attributes) ⇒ Object
- #each(&block) ⇒ Object
- #record_attributes ⇒ Object
- #records ⇒ Object
Methods included from Finders
#[], #method_missing, #respond_to?
Methods inherited from Base
#body, #initialize, #inspect, #json, #prepare_request, root
Constructor Details
This class inherits a constructor from Windy::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Windy::Finders
Instance Method Details
#create_record(attributes) ⇒ Object
101 102 103 |
# File 'lib/windy.rb', line 101 def create_record(attributes) record_class.new(attributes) end |
#each(&block) ⇒ Object
87 88 89 |
# File 'lib/windy.rb', line 87 def each(&block) records.each(&block) end |
#record_attributes ⇒ Object
91 92 93 |
# File 'lib/windy.rb', line 91 def record_attributes json end |
#records ⇒ Object
95 96 97 98 99 |
# File 'lib/windy.rb', line 95 def records @records ||= record_attributes.map do |attributes| create_record(attributes) end end |