Module: NCore::Identity
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/ncore/identity.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
-
#==(comparison_object) ⇒ Object
(also: #eql?)
from ActiveRecord::Core.
- #hash ⇒ Object
- #json_root ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#==(comparison_object) ⇒ Object Also known as: eql?
from ActiveRecord::Core
31 32 33 34 35 36 |
# File 'lib/ncore/identity.rb', line 31 def ==(comparison_object) super || comparison_object.instance_of?(self.class) && !id.nil? && comparison_object.id == id end |
#hash ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/ncore/identity.rb', line 39 def hash if id self.class.hash ^ id.hash else super end end |
#json_root ⇒ Object
47 48 49 |
# File 'lib/ncore/identity.rb', line 47 def json_root self.class.json_root end |
#to_s ⇒ Object
51 52 53 |
# File 'lib/ncore/identity.rb', line 51 def to_s "#{self.class.name}(id=#{id})" end |