Class: Less2Sass::Exec::Base
- Inherits:
-
Object
- Object
- Less2Sass::Exec::Base
- Defined in:
- lib/less2sass/exec/base.rb
Overview
The abstract base class for Less2Sass executables.
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(args) ⇒ Base
constructor
A new instance of Base.
-
#parse ⇒ Object
Parses the command-line arguments and runs the executable.
-
#parse! ⇒ Object
Parses the command-line arguments and runs the executable.
Constructor Details
#initialize(args) ⇒ Base
Returns a new instance of Base.
8 9 10 11 |
# File 'lib/less2sass/exec/base.rb', line 8 def initialize(args) @args = args @options = {} end |
Instance Method Details
#parse ⇒ Object
Parses the command-line arguments and runs the executable.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/less2sass/exec/base.rb', line 29 def parse # @opts = OptionParser.new(&method(:set_opts)) OptionParser.new do |opts| set_opts(opts) end.parse!(@args) process_args @options end |
#parse! ⇒ Object
Parses the command-line arguments and runs the executable. Calls ‘Kernel#exit` at the end, so it never returns.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/less2sass/exec/base.rb', line 17 def parse! begin parse rescue Exception => e raise e if @options[:trace] || e.is_a?(SystemExit) $stderr.puts "#{e.class}: " + e..to_s exit 1 end exit 0 end |