Class: ROM::Components::Mapper

Inherits:
Core
  • Object
show all
Defined in:
lib/rom/components/mapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#constantClass (readonly)

Returns Component's target class.

Returns:

  • (Class)

    Component's target class



11
# File 'lib/rom/components/mapper.rb', line 11

option :constant, type: Types.Interface(:new), optional: true

#objectClass (readonly)

Returns Pre-initialized object that should be used instead of the constant.

Returns:

  • (Class)

    Pre-initialized object that should be used instead of the constant



16
# File 'lib/rom/components/mapper.rb', line 16

option :object, optional: true

Instance Method Details

#buildObject



19
20
21
# File 'lib/rom/components/mapper.rb', line 19

def build
  object || constant.build
end

#relationObject



24
25
26
# File 'lib/rom/components/mapper.rb', line 24

def relation
  config.relation
end