class NetLinx::CompilerResult
Contains info pertaining to a job run through the compiler.
Attributes
See Compilable interface.
See Compilable interface.
See Compilable interface.
See Compilable interface.
Number of compiler errors.
The raw stream of text returned by the compiler.
Number of compiler warnings.
Public Class Methods
@option kwargs [String] :stream The raw stream of text returned by the compiler. @option kwargs [Array<String>] :compiler_target_files See Compilable interface. @option kwargs [Array<String>] :compiler_include_paths See Compilable interface. @option kwargs [Array<String>] :compiler_module_paths See Compilable interface. @option kwargs [Array<String>] :compiler_library_paths See Compilable interface.
# File lib/netlinx/compiler_result.rb, line 27 def initialize(**kwargs) @stream = kwargs.fetch :stream, '' @compiler_target_files = kwargs.fetch :compiler_target_files, [] @compiler_include_paths = kwargs.fetch :compiler_include_paths, [] @compiler_module_paths = kwargs.fetch :compiler_module_paths, [] @compiler_library_paths = kwargs.fetch :compiler_library_paths, [] # Capture error and warning counts. @errors = nil @warnings = nil @stream.scan /(\d+) error\(s\), (\d+) warning\(s\)/ do |e, w| @errors = e.to_i if e @warnings = w.to_i if w end end
Public Instance Methods
@return [Array<String>] a list of errors.
# File lib/netlinx/compiler_result.rb, line 66 def error_items @stream.scan(/(^ERROR: .*$)/).map {|i| i.first} end
@return [Boolean] true if compile was successful.
# File lib/netlinx/compiler_result.rb, line 56 def success? @errors == 0 && @warnings == 0 end
@return [String] the absolute path of the source code file that was compiled.
# File lib/netlinx/compiler_result.rb, line 51 def target_file @compiler_target_files.first end
Alias of {#stream}.
# File lib/netlinx/compiler_result.rb, line 46 def to_s @stream end
@return [Array<String>] a list of warnings.
# File lib/netlinx/compiler_result.rb, line 61 def warning_items @stream.scan(/(^WARNING: .*$)/).map {|i| i.first} end