class ROM::Commands::Composite

Composite command that consists of left and right commands

@api public

Public Instance Methods

[](*args)
Alias for: call
call(*args) click to toggle source

Calls the composite command

Right command is called with a result from the left one

@return [Object]

@api public

# File lib/rom/commands/composite.rb, line 18
def call(*args)
  response = left.call(*args)

  if response.nil? || (many? && response.empty?)
    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
Also aliased as: []
decorate?(response) click to toggle source

@api private

Calls superclass method
# File lib/rom/commands/composite.rb, line 50
def decorate?(response)
  super || response.is_a?(Graph)
end
graph?() click to toggle source

@api private

# File lib/rom/commands/composite.rb, line 40
def graph?
  left.is_a?(Graph)
end
result() click to toggle source

@api private

# File lib/rom/commands/composite.rb, line 45
def result
  left.result
end