Class: Hilbert::Exec::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/hilbert/exec.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Compiler

Returns a new instance of Compiler.



4
5
6
# File 'lib/hilbert/exec.rb', line 4

def initialize(args)
  @args = args
end

Instance Method Details

#output!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hilbert/exec.rb', line 8

def output!
  ch_compile_type(@args.first)
  parse_string = parse(@args[1])
  write!(@args[2], parse_string)

rescue Exception => e
  raise e if @options[:trace] || e.is_a?(SystemExit)

  print "#{e.class}: " unless e.class == RuntimeError
  puts "#{e.message}"
  puts '  Use --trace for backtrace.'
  exit 1
ensure
  exit 0
end