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
44 45 46 47 48 |
# File 'lib/superstore/core.rb', line 44 def ==(comparison_object) comparison_object.equal?(self) || (comparison_object.instance_of?(self.class) && comparison_object.id == id) end |
#eql?(comparison_object) ⇒ Boolean
50 51 52 |
# File 'lib/superstore/core.rb', line 50 def eql?(comparison_object) self == (comparison_object) end |
#hash ⇒ Object
29 30 31 |
# File 'lib/superstore/core.rb', line 29 def hash id.hash end |
#initialize(attributes = nil) {|_self| ... } ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/superstore/core.rb', line 5 def initialize(attributes=nil) @new_record = true @destroyed = false @attributes = {} self.attributes = attributes || {} yield self if block_given? end |
#initialize_dup(other) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/superstore/core.rb', line 14 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 super end |
#to_param ⇒ Object
25 26 27 |
# File 'lib/superstore/core.rb', line 25 def to_param id end |