Class: ROM::Commands::Composite
- Inherits:
-
Pipeline::Composite
- Object
- Pipeline::Composite
- ROM::Commands::Composite
- Defined in:
- lib/rom/commands/composite.rb
Overview
Composite command that consists of left and right commands
Instance Attribute Summary
Attributes inherited from Pipeline::Composite
Instance Method Summary collapse
-
#call(*args) ⇒ Object
(also: #[])
Calls the composite command.
- #decorate?(response) ⇒ Boolean private
- #graph? ⇒ Boolean private
- #result ⇒ Object private
Methods inherited from Pipeline::Composite
Methods included from Pipeline::Proxy
Constructor Details
This class inherits a constructor from ROM::Pipeline::Composite
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ROM::Pipeline::Proxy
Instance Method Details
#call(*args) ⇒ Object Also known as: []
Calls the composite command
Right command is called with a result from the left one
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rom/commands/composite.rb', line 16 def call(*args) response = left.call(*args) if response.nil? || (many? && response.size == 0) return one? ? nil : EMPTY_ARRAY end if one? && !graph? if right.is_a?(Command) || right.is_a?(Commands::Composite) right.call([response].first) else right.call([response]).first end elsif one? && graph? right.call(response).first else right.call(response) end end |
#decorate?(response) ⇒ Boolean
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.
48 49 50 |
# File 'lib/rom/commands/composite.rb', line 48 def decorate?(response) super || response.is_a?(Graph) end |
#graph? ⇒ Boolean
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.
38 39 40 |
# File 'lib/rom/commands/composite.rb', line 38 def graph? left.is_a?(Graph) end |
#result ⇒ 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.
43 44 45 |
# File 'lib/rom/commands/composite.rb', line 43 def result left.result end |