Class: ROM::Changeset::Pipe
- Inherits:
-
Object
- Object
- ROM::Changeset::Pipe
- Extended by:
- Transproc::Registry
- Defined in:
- lib/rom/repository/changeset/pipe.rb
Instance Attribute Summary collapse
-
#processor ⇒ Object
readonly
Returns the value of attribute processor.
Class Method Summary collapse
Instance Method Summary collapse
- #>>(other) ⇒ Object
- #call(data) ⇒ Object
-
#initialize(processor = nil) ⇒ Pipe
constructor
A new instance of Pipe.
Constructor Details
#initialize(processor = nil) ⇒ Pipe
19 20 21 |
# File 'lib/rom/repository/changeset/pipe.rb', line 19 def initialize(processor = nil) @processor = processor end |
Instance Attribute Details
#processor ⇒ Object (readonly)
Returns the value of attribute processor.
8 9 10 |
# File 'lib/rom/repository/changeset/pipe.rb', line 8 def processor @processor end |
Class Method Details
.add_timestamps(data) ⇒ Object
10 11 12 13 |
# File 'lib/rom/repository/changeset/pipe.rb', line 10 def self.(data) now = Time.now data.merge(created_at: now, updated_at: now) end |
.touch(data) ⇒ Object
15 16 17 |
# File 'lib/rom/repository/changeset/pipe.rb', line 15 def self.touch(data) data.merge(updated_at: Time.now) end |
Instance Method Details
#>>(other) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rom/repository/changeset/pipe.rb', line 23 def >>(other) if processor self.class.new(processor >> other) else self.class.new(other) end end |
#call(data) ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/rom/repository/changeset/pipe.rb', line 31 def call(data) if processor processor.call(data) else data end end |