Sha256: a35304ddeefa66fb3a35feb90a845cedabaeb8436522f6501d94dac5871d3938

Contents?: true

Size: 530 Bytes

Versions: 162

Compression:

Stored size: 530 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)
    attributes.each do |k, v|
      instance_variable_set "@#{k.to_s}".to_sym, v
      
      self.class.send :attr_accessor, k
    end
  end

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

  def pid
    @pid
  end
end

Version data entries

162 entries across 162 versions & 3 rubygems

Version Path
hydra-core-13.0.0 spec/support/app/models/sample.rb
hydra-core-12.1.0 spec/support/app/models/sample.rb
hydra-core-12.0.2 spec/support/app/models/sample.rb
hydra-core-11.0.7 spec/support/app/models/sample.rb
hydra-core-12.0.1 spec/support/app/models/sample.rb
hydra-core-11.0.6 spec/support/app/models/sample.rb
hydra-core-11.0.5 spec/support/app/models/sample.rb
hydra-core-11.0.4 spec/support/app/models/sample.rb
hydra-core-12.0.0 spec/support/app/models/sample.rb
hydra-core-11.0.1 spec/support/app/models/sample.rb
hydra-core-11.0.0 spec/support/app/models/sample.rb
hydra-core-11.0.0.rc2 spec/support/app/models/sample.rb
hydra-core-10.7.0 spec/support/app/models/sample.rb
hydra-core-10.6.2 spec/support/app/models/sample.rb
hydra-core-10.6.1 spec/support/app/models/sample.rb
hydra-core-10.6.0 spec/support/app/models/sample.rb
hydra-core-10.5.1 spec/support/app/models/sample.rb
hydra-core-11.0.0.rc1 spec/support/app/models/sample.rb
hydra-core-10.5.0 spec/support/app/models/sample.rb
hydra-core-8.2.0 spec/support/app/models/sample.rb