Module: Airtable::ORM::Core
Instance Method Summary collapse
-
#==(other) ⇒ Object
(also: #eql?)
Instance comparison.
-
#freeze ⇒ Object
Freeze the record.
- #hash ⇒ Object
-
#inspect ⇒ Object
Inspect method for better debugging.
-
#to_h ⇒ Object
Convert to hash with symbol keys.
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
Instance comparison
9 10 11 12 13 14 |
# File 'lib/airtable/orm/core.rb', line 9 def ==(other) return false unless other.is_a?(self.class) return false if new_record? || other.new_record? id == other.id end |
#freeze ⇒ Object
Freeze the record
42 43 44 45 46 |
# File 'lib/airtable/orm/core.rb', line 42 def freeze @id.freeze @created_at.freeze super end |
#hash ⇒ Object
18 19 20 |
# File 'lib/airtable/orm/core.rb', line 18 def hash [self.class, id].hash end |
#inspect ⇒ Object
Inspect method for better debugging
23 24 25 26 27 28 29 30 |
# File 'lib/airtable/orm/core.rb', line 23 def inspect attribute_string = self.class.attribute_types.map do |name, _type| value = read_raw_attribute(name.to_sym) "#{name}: #{value.inspect}" end.join(", ") "#<#{self.class.name} id: #{id.inspect}, #{attribute_string}>" end |
#to_h ⇒ Object
Convert to hash with symbol keys
33 34 35 36 37 38 39 |
# File 'lib/airtable/orm/core.rb', line 33 def to_h { id: id, created_at: created_at, **symbol_attributes } end |