Sha256: 001f407c815d578e00685fe9d1a46a1c81450d739b274d203541c7a34f6a9071

Contents?: true

Size: 536 Bytes

Versions: 3

Compression:

Stored size: 536 Bytes

Contents

class Sample
  # This is a stub model for testing.

  cattr_accessor :objects
  self.objects = {}

  def self.create(params={})
    obj = Sample.new
    obj.save
    obj
  end

  def save()
    @pid ||= "sample:#{(rand * 1000).to_i}"
    self.class.objects[@pid] = self
  end

  def update_attributes(attributes)
    metaclass = class << self; self; end
    attributes.each do |k, v|
      metaclass.send(:define_method, k) do
        v
      end
    end
  end

  def self.find(pid)
    objects[pid]
  end

  def pid
    @pid
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hydra-batch-edit-0.0.5 spec/support/app/models/sample.rb
hydra-batch-edit-0.0.4 spec/support/app/models/sample.rb
hydra-batch-edit-0.0.3 spec/support/app/models/sample.rb