Module: Traits::Attribute::Inheritance

Included in:
Traits::Attribute
Defined in:
lib/traits/attribute/inheritance.rb

Instance Method Summary collapse

Instance Method Details

#inheritance_type?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/traits/attribute/inheritance.rb', line 7

def inheritance_type?
  (model.inheritance_base? || model.inheritance_derived?) and name == model.inheritance_attribute.name
end

#to_hashObject



11
12
13
# File 'lib/traits/attribute/inheritance.rb', line 11

def to_hash
  super.merge!(is_inheritance_type: inheritance_type?)
end