Class: Hum::Exec::Generic

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

Direct Known Subclasses

Hum

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ Generic

Returns a new instance of Generic.



12
13
14
15
16
17
18
19
20
# File 'lib/hum/exec.rb', line 12

def initialize(args)
  @args = args
  
  #Command line options
  @options = {}
  
  #Files to output
  @files = {}
end

Instance Method Details

#parseObject



31
32
33
34
35
36
37
38
# File 'lib/hum/exec.rb', line 31

def parse
  @opts = OptionParser.new(&method(:set_opts))
  if @args.kind_of? String
    @args = [@args]
  end
  @opts.parse!(@args)
  process_result
end

#parse!Object



22
23
24
25
26
27
28
29
# File 'lib/hum/exec.rb', line 22

def parse!
  begin
    parse
  rescue Exception => e
    exit 1
  end
  exit 0
end