Module: OptparsePlus
- Included in:
- OptionParser
- Defined in:
- lib/optparse_plus.rb,
lib/optparse_plus/version.rb
Defined Under Namespace
Modules: ClassMethods
Classes: OptPlus
Constant Summary
collapse
- VERSION =
"0.0.2"
Instance Attribute Summary collapse
Instance Method Summary
collapse
Instance Attribute Details
#opt_plus ⇒ Object
Returns the value of attribute opt_plus.
7
8
9
|
# File 'lib/optparse_plus.rb', line 7
def opt_plus
@opt_plus
end
|
Instance Method Details
#inherit_ruby_options(*short_option_names) ⇒ Object
146
147
148
|
# File 'lib/optparse_plus.rb', line 146
def inherit_ruby_options(*short_option_names)
@opt_plus.inherit_ruby_options(*short_option_names)
end
|
#on(*args, &callback) ⇒ Object
128
129
130
131
132
133
134
|
# File 'lib/optparse_plus.rb', line 128
def on(*args, &callback)
if args.length == 1 and args[0].kind_of? Symbol
on_with(*args, &callback)
else
super(*args)
end
end
|
#on_with(option_label, &callback) ⇒ Object
123
124
125
126
|
# File 'lib/optparse_plus.rb', line 123
def on_with(option_label, &callback)
args = @opt_plus.config_to_args(option_label)
_orig_on(*args, callback)
end
|
#parse! ⇒ Object
136
137
138
139
|
# File 'lib/optparse_plus.rb', line 136
def parse!
@opt_plus.opt_on if @opt_plus
super
end
|
#setup_opt_plus(opt_plus) ⇒ Object
141
142
143
144
|
# File 'lib/optparse_plus.rb', line 141
def setup_opt_plus(opt_plus)
@opt_plus = opt_plus
opt_plus.opt = self
end
|
#with(option_label, &callback) ⇒ Object
118
119
120
|
# File 'lib/optparse_plus.rb', line 118
def with(option_label, &callback)
@opt_plus.callbacks[option_label] = callback
end
|