Class: Dillo::Collection

Inherits:
Base
  • Object
show all
Includes:
Finders, Enumerable
Defined in:
lib/dillo.rb

Direct Known Subclasses

Columns, Page, Rows

Instance Attribute Summary

Attributes inherited from Base

#connection

Instance Method Summary collapse

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_attributesObject



129
130
131
# File 'lib/dillo.rb', line 129

def record_attributes
  json
end

#recordsObject



133
134
135
136
137
# File 'lib/dillo.rb', line 133

def records
  @records ||= record_attributes.map do |attributes|
    create_record(attributes)
  end
end