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.



8
9
10
11
# File 'lib/slim/command.rb', line 8

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



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

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