Class: ROM::Transformer
- Inherits:
-
Object
- Object
- ROM::Transformer
- Extended by:
- Dry::Core::ClassAttributes
- Defined in:
- core/lib/rom/transformer.rb
Overview
Transformer is a data mapper which uses Transproc's transformer DSL to define transformations.
Class Method Summary collapse
-
.base_relation ⇒ Object
private
This is needed to make transformers compatible with rom setup.
-
.build ⇒ Transformer
Build a mapper instance.
-
.map(&block) ⇒ self
Define transformation pipeline.
-
.register_as ⇒ Object
Get or set registration name.
-
.relation(name = Undefined, options = EMPTY_HASH) ⇒ Object
Configure relation for the transformer.
Class Method Details
.base_relation ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is needed to make transformers compatible with rom setup
82 83 84 |
# File 'core/lib/rom/transformer.rb', line 82 def self.base_relation relation end |
.build ⇒ Transformer
Build a mapper instance
91 92 93 |
# File 'core/lib/rom/transformer.rb', line 91 def self.build new end |
.map(&block) ⇒ self
Define transformation pipeline
73 74 75 76 77 |
# File 'core/lib/rom/transformer.rb', line 73 def self.map(&block) define! do map_array(&block) end end |
.register_as ⇒ Symbol .register_as(name) ⇒ Object
Get or set registration name
32 |
# File 'core/lib/rom/transformer.rb', line 32 defines :register_as |
.relation(name = Undefined, options = EMPTY_HASH) ⇒ Object
Configure relation for the transformer
53 54 55 56 57 58 |
# File 'core/lib/rom/transformer.rb', line 53 def self.relation(name = Undefined, = EMPTY_HASH) return @relation if name.equal?(Undefined) && defined?(@relation) register_as(.fetch(:as, name)) @relation = name end |