class Ikra::Translator::EntireInputTranslationResult
Instance of this class store the result of translation of multiple input commands. Instance methods can be used to access the values of the translated commands. Most methods support access by index and access by range, in which case values are aggregated, if meaningful.
Public Class Methods
new(input_translation_results)
click to toggle source
# File lib/translator/input_translator.rb, line 148 def initialize(input_translation_results) @input = input_translation_results end
Public Instance Methods
block_parameters(index = 0..-1)
click to toggle source
# File lib/translator/input_translator.rb, line 152 def block_parameters(index = 0..-1) if index.is_a?(Fixnum) return @input[index].parameters elsif index.is_a?(Range) return @input[index].reduce([]) do |acc, n| acc + n.parameters end else raise ArgumentError.new("Expected Fixnum or Range") end end
command_translation_result(index)
click to toggle source
# File lib/translator/input_translator.rb, line 221 def command_translation_result(index) return @input[index].command_translation_result end
execution(index = 0..-1)
click to toggle source
# File lib/translator/input_translator.rb, line 197 def execution(index = 0..-1) if index.is_a?(Fixnum) return @input[index].command_translation_result.execution elsif index.is_a?(Range) return @input[index].reduce("") do |acc, n| acc + n.command_translation_result.execution end else raise ArgumentError.new("Expected Fixnum or Range") end end
override_block_parameters(index = 0..-1)
click to toggle source
# File lib/translator/input_translator.rb, line 176 def override_block_parameters(index = 0..-1) if index.is_a?(Fixnum) if @input[index].override_block_parameters == nil # No override specified return @input[index].parameters else return @input[index].override_block_parameters end elsif index.is_a?(Range) return @input[index].reduce([]) do |acc, n| if n.override_block_parameters == nil acc + n.parameters else acc + n.override_block_parameters end end else raise ArgumentError.new("Expected Fixnum or Range") end end
pre_execution(index = 0..-1)
click to toggle source
# File lib/translator/input_translator.rb, line 164 def pre_execution(index = 0..-1) if index.is_a?(Fixnum) return @input[index].pre_execution elsif index.is_a?(Range) return @input[index].reduce("") do |acc, n| acc + "\n" + n.pre_execution end else raise ArgumentError.new("Expected Fixnum or Range") end end
result(index = 0..-1)
click to toggle source
# File lib/translator/input_translator.rb, line 209 def result(index = 0..-1) if index.is_a?(Fixnum) return @input[index].command_translation_result.result elsif index.is_a?(Range) return @input[index].map do |n| n.command_translation_result.result end else raise ArgumentError.new("Expected Fixnum or Range") end end