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.3"
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
160
161
162
|
# File 'lib/optparse_plus.rb', line 160
def inherit_ruby_options(*short_option_names)
@opt_plus.inherit_ruby_options(*short_option_names)
end
|
#on(*args, &callback) ⇒ Object
142
143
144
145
146
147
148
|
# File 'lib/optparse_plus.rb', line 142
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
137
138
139
140
|
# File 'lib/optparse_plus.rb', line 137
def on_with(option_label, &callback)
args = @opt_plus.config_to_args(option_label)
_orig_on(*args, callback)
end
|
#parse! ⇒ Object
150
151
152
153
|
# File 'lib/optparse_plus.rb', line 150
def parse!
@opt_plus.opt_on if @opt_plus
super
end
|
#setup_opt_plus(opt_plus) ⇒ Object
155
156
157
158
|
# File 'lib/optparse_plus.rb', line 155
def setup_opt_plus(opt_plus)
@opt_plus = opt_plus
opt_plus.opt = self
end
|
#with(option_label, &callback) ⇒ Object
132
133
134
|
# File 'lib/optparse_plus.rb', line 132
def with(option_label, &callback)
@opt_plus.callbacks[option_label] = callback
end
|