Class: Dillo::Collection
- Includes:
- Finders, Enumerable
- Defined in:
- lib/dillo.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 Dillo::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Dillo::Finders
Instance Method Details
#create_record(attributes) ⇒ Object
139 140 141 |
# File 'lib/dillo.rb', line 139 def create_record(attributes) record_class.new(attributes) end |
#each(&block) ⇒ Object
125 126 127 |
# File 'lib/dillo.rb', line 125 def each(&block) records.each(&block) end |
#record_attributes ⇒ Object
129 130 131 |
# File 'lib/dillo.rb', line 129 def record_attributes json end |
#records ⇒ Object
133 134 135 136 137 |
# File 'lib/dillo.rb', line 133 def records @records ||= record_attributes.map do |attributes| create_record(attributes) end end |