class Ikra::Symbolic::ArrayReduceCommand

Public Class Methods

new( target, block, block_size: DEFAULT_BLOCK_SIZE, ast: nil, generator_node: nil, command_binding: nil) click to toggle source
Calls superclass method Ikra::Symbolic::ArrayCommand::new
# File lib/symbolic/symbolic.rb, line 502
def initialize(
    target, 
    block, 
    block_size: DEFAULT_BLOCK_SIZE, 
    ast: nil,
    generator_node: nil,
    command_binding: nil)

    super(block: block, block_ast: ast, block_size: block_size, keep: keep, generator_node: generator_node, command_binding: command_binding)

    @input = [ReduceInput.new(command: target.to_command, pattern: :entire)]
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method Ikra::Symbolic::ArrayCommand#==
# File lib/symbolic/symbolic.rb, line 534
def ==(other)
    return super(other) && size == other.size
end
accept(visitor) click to toggle source
# File lib/symbolic/visitor.rb, line 16
def accept(visitor)
    visitor.visit_array_reduce_command(self)
end
execute() click to toggle source
Calls superclass method Ikra::Symbolic::ArrayCommand#execute
# File lib/symbolic/symbolic.rb, line 515
def execute
    if input.first.command.size == 0
        @result = [nil]
    elsif @input.first.command.size == 1
        @result = [input.first.command[0]]
    else
        @result = super
    end
end
input_size() click to toggle source

Returns the number of elements in the input

# File lib/symbolic/symbolic.rb, line 530
def input_size
    return input.first.command.size
end
size() click to toggle source
# File lib/symbolic/symbolic.rb, line 525
def size
    return 1
end