Class: Opener::Daemons::OptParser

Inherits:
Object
  • Object
show all
Defined in:
lib/opener/daemons/opt_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ OptParser

Returns a new instance of OptParser.



8
9
10
11
# File 'lib/opener/daemons/opt_parser.rb', line 8

def initialize(&block)
  @options = {}
  @option_parser = construct_option_parser(options, &block)
end

Instance Attribute Details

#option_parserObject

Returns the value of attribute option_parser.



6
7
8
# File 'lib/opener/daemons/opt_parser.rb', line 6

def option_parser
  @option_parser
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/opener/daemons/opt_parser.rb', line 6

def options
  @options
end

Class Method Details

.parse(args) ⇒ Object



31
32
33
# File 'lib/opener/daemons/opt_parser.rb', line 31

def self.parse(args)
  new.parse(args)
end

.parse!(args) ⇒ Object



35
36
37
# File 'lib/opener/daemons/opt_parser.rb', line 35

def self.parse!(args)
  new.parse!(args)
end

.pre_parse(args) ⇒ Object



43
44
45
# File 'lib/opener/daemons/opt_parser.rb', line 43

def self.pre_parse(args)
  new.pre_parse(args)
end

.pre_parse!(args) ⇒ Object



39
40
41
# File 'lib/opener/daemons/opt_parser.rb', line 39

def self.pre_parse!(args)
  new.pre_parse!(args)
end

Instance Method Details

#parse(args) ⇒ Object



13
14
15
# File 'lib/opener/daemons/opt_parser.rb', line 13

def parse(args)
  process(:parse, args)
end

#parse!(args) ⇒ Object



17
18
19
# File 'lib/opener/daemons/opt_parser.rb', line 17

def parse!(args)
  process(:parse!, args)
end

#pre_parse(args) ⇒ Object



26
27
28
29
# File 'lib/opener/daemons/opt_parser.rb', line 26

def pre_parse(args)
  delete_double_dash = false
  process(:parse, args, delete_double_dash)
end

#pre_parse!(args) ⇒ Object



21
22
23
24
# File 'lib/opener/daemons/opt_parser.rb', line 21

def pre_parse!(args)
  delete_double_dash = false
  process(:parse!, args, delete_double_dash)
end