class Ikra::Symbolic::ArrayHostSectionCommand

The return value of a host section. For the moment, every host section can only have one result.

Attributes

block[R]
section_input[R]

Public Class Methods

new(*section_input, &block) click to toggle source
# File lib/symbolic/host_section.rb, line 13
def initialize(*section_input, &block)
    @block = block
    @section_input = section_input
end

Public Instance Methods

accept(visitor) click to toggle source
# File lib/symbolic/visitor.rb, line 46
def accept(visitor)
    visitor.visit_array_host_section_command(self)
end
block_def_node() click to toggle source

Returns the abstract syntax tree for this section.

# File lib/symbolic/host_section.rb, line 24
def block_def_node
    if @ast == nil
        # Get array of block parameter names
        block_params = block.parameters.map do |param|
            param[1]
        end

        parser_local_vars = command_binding.local_variables + block_params
        source = Parsing.parse_block(block, parser_local_vars)
        @ast = AST::BlockDefNode.new(
            parameters: block_params,
            ruby_block: block,      # necessary to get binding
            body: AST::HostSectionBuilder.from_parser_ast(source))
    end

    return @ast
end
command_translator_class() click to toggle source
# File lib/symbolic/host_section.rb, line 42
def command_translator_class
    return Translator::HostSectionCommandTranslator
end
size() click to toggle source
# File lib/symbolic/host_section.rb, line 18
def size
    execute
    return @result.size
end