Class: HTML2Slim::Command
- Inherits:
-
Object
- Object
- HTML2Slim::Command
- Defined in:
- lib/html2slim/command.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(args) ⇒ Command
constructor
A new instance of Command.
- #run ⇒ Object
Constructor Details
#initialize(args) ⇒ Command
Returns a new instance of Command.
7 8 9 10 |
# File 'lib/html2slim/command.rb', line 7 def initialize(args) @args = args @options = {} end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/html2slim/command.rb', line 12 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. $stderr.puts ' Use --trace for backtrace.' exit 1 end |