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
-
.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
.build ⇒ Transformer
Build a mapper instance
92 93 94 |
# File 'core/lib/rom/transformer.rb', line 92 def self.build new end |
.map(&block) ⇒ self
Define transformation pipeline
74 75 76 77 78 |
# File 'core/lib/rom/transformer.rb', line 74 def self.map(&block) define! do map_array(&block) end end |
.register_as ⇒ Symbol .register_as(name) ⇒ Object
Get or set registration name
33 |
# File 'core/lib/rom/transformer.rb', line 33 defines :register_as |
.relation(name = Undefined, options = EMPTY_HASH) ⇒ Object
Configure relation for the transformer
54 55 56 57 58 59 |
# File 'core/lib/rom/transformer.rb', line 54 def self.relation(name = Undefined, = EMPTY_HASH) return @relation if name.equal?(Undefined) && defined?(@relation) register_as(.fetch(:as, name)) @relation = name end |