Class: CssCompare::Comparison

Inherits:
Object
  • Object
show all
Defined in:
lib/css_compare/exec.rb

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Comparison

Returns a new instance of Comparison.



6
7
8
9
# File 'lib/css_compare/exec.rb', line 6

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

Instance Method Details

#parseObject

Parses the command-line arguments and runs the executable.



27
28
29
30
31
32
33
34
# File 'lib/css_compare/exec.rb', line 27

def parse
  @opts = OptionParser.new { |opts| process_opts(opts) }
  @opts.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.

See Also:



15
16
17
18
19
20
21
22
23
24
# File 'lib/css_compare/exec.rb', line 15

def parse!
  begin
    parse
  rescue StandardError => e
    raise e if @options[:trace] || e.is_a?(SystemExit)
    $stderr.puts "#{e.class}: " + e.message.to_s
    exit 1
  end
  exit 0
end