class ButterCMS::ButterCollection

Attributes

items[R]
meta[R]

Public Class Methods

new(klass, json) click to toggle source
# File lib/buttercms/butter_collection.rb, line 8
def initialize(klass, json)
  data = json["data"]
  meta = json["meta"]

  @meta = HashToObject.convert(meta) if meta
  @items = data.map {|o| klass.new("data" => o) }
end

Public Instance Methods

each(&block) click to toggle source
# File lib/buttercms/butter_collection.rb, line 16
def each(&block)
  @items.each do |member|
    block.call(member)
  end
end