Class: Lrama::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/lrama/command.rb

Constant Summary collapse

LRAMA_LIB =
File.realpath(File.join(File.dirname(__FILE__)))
STDLIB_FILE_PATH =
File.join(LRAMA_LIB, 'grammar', 'stdlib.y')

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Command

Returns a new instance of Command.



8
9
10
11
12
13
14
15
16
# File 'lib/lrama/command.rb', line 8

def initialize(argv)
  @logger = Lrama::Logger.new
  @options = OptionParser.parse(argv)
  @tracer = Tracer.new(STDERR, **@options.trace_opts)
  @reporter = Reporter.new(**@options.report_opts)
  @warnings = Warnings.new(@logger, @options.warnings)
rescue => e
  abort format_error_message(e.message)
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
# File 'lib/lrama/command.rb', line 18

def run
  Lrama::Reporter::Profile::CallStack.report(@options.profile_opts[:call_stack]) do
    Lrama::Reporter::Profile::Memory.report(@options.profile_opts[:memory]) do
      execute_command_workflow
    end
  end
end