Class: Exwiw::BelongsTo

Inherits:
Object
  • Object
show all
Includes:
Serdes
Defined in:
lib/exwiw/belongs_to.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_symbol_keys(hash) ⇒ Object



22
23
24
# File 'lib/exwiw/belongs_to.rb', line 22

def self.from_symbol_keys(hash)
  from(hash.transform_keys(&:to_s))
end

Instance Method Details

#identityObject

Structural identity used to match a freshly generated belongs_to against a user-maintained one during merge. ‘comment`/`ignore` are user-owned and so are intentionally excluded.



33
34
35
# File 'lib/exwiw/belongs_to.rb', line 33

def identity
  [table_name, foreign_key, foreign_type, type_value]
end

#polymorphic?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/exwiw/belongs_to.rb', line 26

def polymorphic?
  !foreign_type.nil?
end

#to_hashObject



37
38
39
# File 'lib/exwiw/belongs_to.rb', line 37

def to_hash
  super.compact
end