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
138 139 140 |
# File 'lib/windy.rb', line 138 def create_record(attributes) record_class.new(attributes) end |
#each(&block) ⇒ Object
124 125 126 |
# File 'lib/windy.rb', line 124 def each(&block) records.each(&block) end |
#record_attributes ⇒ Object
128 129 130 |
# File 'lib/windy.rb', line 128 def record_attributes json end |
#records ⇒ Object
132 133 134 135 136 |
# File 'lib/windy.rb', line 132 def records @records ||= record_attributes.map do |attributes| create_record(attributes) end end |