Class: Opener::Core::OptParser

Inherits:
Object
  • Object
show all
Defined in:
lib/opener/core/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.



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

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

Instance Attribute Details

#option_parserObject

Returns the value of attribute option_parser.



4
5
6
# File 'lib/opener/core/opt_parser.rb', line 4

def option_parser
  @option_parser
end

#optionsObject

Returns the value of attribute options.



4
5
6
# File 'lib/opener/core/opt_parser.rb', line 4

def options
  @options
end

Class Method Details

.parse(args) ⇒ Object



29
30
31
# File 'lib/opener/core/opt_parser.rb', line 29

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

.parse!(args) ⇒ Object



33
34
35
# File 'lib/opener/core/opt_parser.rb', line 33

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

.pre_parse(args) ⇒ Object



41
42
43
# File 'lib/opener/core/opt_parser.rb', line 41

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

.pre_parse!(args) ⇒ Object



37
38
39
# File 'lib/opener/core/opt_parser.rb', line 37

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

Instance Method Details

#parse(args) ⇒ Object



11
12
13
# File 'lib/opener/core/opt_parser.rb', line 11

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

#parse!(args) ⇒ Object



15
16
17
# File 'lib/opener/core/opt_parser.rb', line 15

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

#pre_parse(args) ⇒ Object



24
25
26
27
# File 'lib/opener/core/opt_parser.rb', line 24

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

#pre_parse!(args) ⇒ Object



19
20
21
22
# File 'lib/opener/core/opt_parser.rb', line 19

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