class GreenButtonData::ModelCollection

Public Class Methods

new() click to toggle source
# File lib/green-button-data/model_collection.rb, line 5
def initialize
  @models = []
end

Public Instance Methods

<<(model) click to toggle source
# File lib/green-button-data/model_collection.rb, line 9
def <<(model)
  @models << model
end
each() { |model| ... } click to toggle source
# File lib/green-button-data/model_collection.rb, line 13
def each
  return enum_for(:each) unless block_given?

  @models.each do |model|
    yield model
  end
end
find_by_id(id) click to toggle source
# File lib/green-button-data/model_collection.rb, line 29
def find_by_id(id)
  self.find {|model| model.id.to_s == id.to_s }
end
last() click to toggle source
# File lib/green-button-data/model_collection.rb, line 21
def last
  @models.last
end
size() click to toggle source
# File lib/green-button-data/model_collection.rb, line 25
def size
  @models.size
end