class Gamifier::Collection

Attributes

engine[RW]
model[R]

Public Class Methods

new(engine, model) click to toggle source
# File lib/gamifier/collection.rb, line 14
def initialize(engine, model)
  @engine = engine
  @model = model
  self.extend model::FinderMethods
end

Public Instance Methods

build(entry) click to toggle source
# File lib/gamifier/collection.rb, line 20
def build(entry)
  instance = model.new(entry)
  instance.engine = engine
  instance
end
path() click to toggle source
# File lib/gamifier/collection.rb, line 10
def path
  model.path
end
reset!(params = {}) click to toggle source
# File lib/gamifier/collection.rb, line 26
def reset!(params = {})
  unless params.has_key?(:site)
    raise ArgumentError, "A :site parameter is required. Pass nil if you really want to delete all the objects of this kind, on all the sites."
  end
  all(params) do |entry|
    entry.destroy
  end
end