Class: Slim::Command Private

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

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Slim commandline interface

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Command

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Command.



10
11
12
13
# File 'lib/slim/command.rb', line 10

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

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Run command



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/slim/command.rb', line 16

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