Class: ButterCMS::ButterCollection
- Inherits:
-
Object
- Object
- ButterCMS::ButterCollection
- Includes:
- Enumerable
- Defined in:
- lib/buttercms/butter_collection.rb
Instance Attribute Summary collapse
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(klass, json) ⇒ ButterCollection
constructor
A new instance of ButterCollection.
Constructor Details
#initialize(klass, json) ⇒ ButterCollection
Returns a new instance of ButterCollection.
7 8 9 10 11 12 13 |
# File 'lib/buttercms/butter_collection.rb', line 7 def initialize(klass, json) data = json["data"] = json["meta"] @meta = HashToObject.convert() if @items = data.map {|o| klass.new("data" => o) } end |
Instance Attribute Details
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
5 6 7 |
# File 'lib/buttercms/butter_collection.rb', line 5 def @meta end |
Instance Method Details
#each(&block) ⇒ Object
15 16 17 18 19 |
# File 'lib/buttercms/butter_collection.rb', line 15 def each(&block) @items.each do |member| block.call(member) end end |