module Pad::Entity
Public Class Methods
included(base)
click to toggle source
# File lib/pad/entity.rb, line 3 def self.included(base) base.instance_eval do attribute :id end end
Public Instance Methods
==(other)
click to toggle source
# File lib/pad/entity.rb, line 9 def ==(other) cmp?(__method__, other) end
cmp?(comparator, other)
click to toggle source
@api private
# File lib/pad/entity.rb, line 22 def cmp?(comparator, other) return false unless other.class == self.class if id.nil? equal?(other) else id.send(comparator, other.id) end end
eql?(other)
click to toggle source
# File lib/pad/entity.rb, line 13 def eql?(other) cmp?(__method__, other) end
hash()
click to toggle source
# File lib/pad/entity.rb, line 17 def hash [self.class, id].hash end