Module: Superstore::Core
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
- #==(comparison_object) ⇒ Object
- #eql?(comparison_object) ⇒ Boolean
- #hash ⇒ Object
- #initialize(attributes = nil) {|_self| ... } ⇒ Object
- #initialize_dup(other) ⇒ Object
- #to_param ⇒ Object
Instance Method Details
#==(comparison_object) ⇒ Object
67 68 69 70 71 |
# File 'lib/superstore/core.rb', line 67 def ==(comparison_object) comparison_object.equal?(self) || (comparison_object.instance_of?(self.class) && comparison_object.id == id) end |
#eql?(comparison_object) ⇒ Boolean
73 74 75 |
# File 'lib/superstore/core.rb', line 73 def eql?(comparison_object) self == (comparison_object) end |
#hash ⇒ Object
63 64 65 |
# File 'lib/superstore/core.rb', line 63 def hash id.hash end |
#initialize(attributes = nil) {|_self| ... } ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/superstore/core.rb', line 36 def initialize(attributes=nil) @new_record = true @destroyed = false @association_cache = {} @attributes = {} self.attributes = attributes || {} yield self if block_given? end |
#initialize_dup(other) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/superstore/core.rb', line 47 def initialize_dup(other) @attributes = other.attributes @attributes['created_at'] = nil @attributes['updated_at'] = nil @attributes.delete(self.class.primary_key) @id = nil @new_record = true @destroyed = false @association_cache = {} super end |
#to_param ⇒ Object
59 60 61 |
# File 'lib/superstore/core.rb', line 59 def to_param id end |