Module: Flatter::Mapper::Traits::FactoryMethods

Included in:
Factory
Defined in:
lib/flatter/mapper/traits.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#extensionObject

Returns the value of attribute extension.



6
7
8
# File 'lib/flatter/mapper/traits.rb', line 6

def extension
  @extension
end

Instance Method Details

#createObject



16
17
18
19
20
21
22
# File 'lib/flatter/mapper/traits.rb', line 16

def create(*)
  super.tap do |mounting|
    mounting.set_traits(traits)
    mounting.trait! if trait?
    mounting.extend_with(extension) if extension.present?
  end
end

#trait?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/flatter/mapper/traits.rb', line 12

def trait?
  !!options[:trait]
end

#traitsObject



8
9
10
# File 'lib/flatter/mapper/traits.rb', line 8

def traits
  Array(options[:traits])
end