module MR::FakeRecord::InstanceMethods

Public Class Methods

new(attrs = nil) click to toggle source
# File lib/mr/fake_record.rb, line 33
def initialize(attrs = nil)
  self.attributes = attrs || {}
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/mr/fake_record.rb, line 37
def ==(other)
  other.kind_of?(self.class) ? self.id == other.id : super
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/mr/fake_record.rb, line 42
def hash
  self.id.hash
end
inspect() click to toggle source
# File lib/mr/fake_record.rb, line 46
def inspect
  object_hex = (self.object_id << 1).to_s(16)
  attributes_inspect = self.class.attributes.map do |attribute|
    "@#{attribute.name}=#{attribute.read(self).inspect}"
  end.sort.join(" ")
  "#<#{self.class}:0x#{object_hex} #{attributes_inspect}>"
end