Class: EEx2Slime::Command

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

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Command

Returns a new instance of Command.



9
10
11
12
# File 'lib/eex2slime/command.rb', line 9

def initialize(args)
  @args    = args
  @options = {}
end

Instance Method Details

#runObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/eex2slime/command.rb', line 14

def run
  @opts = OptionParser.new(&method(:set_opts))
  @opts.parse!(@args)
  process!
  exit 0
rescue => error
  raise error if @options[:trace] || SystemExit === error
  $stderr.print "#{error.class}: " if error.class != RuntimeError
  $stderr.puts error.message
  $stderr.puts '  Use --trace for backtrace.'
  exit 1
end