Class: Haml::Exec::Generic

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

Overview

A class that encapsulates the executable code for all three executables.

Direct Known Subclasses

CSS2Sass, HTML2Haml, HamlSass

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Generic

:nodoc:



13
14
15
16
# File 'lib/haml/exec.rb', line 13

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

Instance Method Details

#parse!Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/haml/exec.rb', line 18

def parse!
  begin
    @opts = OptionParser.new(&method(:set_opts))
    @opts.parse!(@args)

    process_result

    @options
  rescue Exception => e
    raise e if @options[:trace] || e.is_a?(SystemExit)

    $stderr.puts e.message
    exit 1
  end
  exit 0
end

#to_sObject



35
36
37
# File 'lib/haml/exec.rb', line 35

def to_s
  @opts.to_s
end