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
126 127 128 |
# File 'lib/windy.rb', line 126 def create_record(attributes) record_class.new(attributes) end |
#each(&block) ⇒ Object
112 113 114 |
# File 'lib/windy.rb', line 112 def each(&block) records.each(&block) end |
#record_attributes ⇒ Object
116 117 118 |
# File 'lib/windy.rb', line 116 def record_attributes json end |
#records ⇒ Object
120 121 122 123 124 |
# File 'lib/windy.rb', line 120 def records @records ||= record_attributes.map do |attributes| create_record(attributes) end end |