Class: IDL::OptionList::Option::Group::ParamSet::Configurator
- Inherits:
-
Object
- Object
- IDL::OptionList::Option::Group::ParamSet::Configurator
- Defined in:
- lib/ridl/optparse_ext.rb
Instance Method Summary collapse
-
#initialize(set) ⇒ Configurator
constructor
A new instance of Configurator.
- #on_exec(&block) ⇒ Object
- #with(param, options = {}) ⇒ Object
- #without(*params) ⇒ Object
Constructor Details
#initialize(set) ⇒ Configurator
Returns a new instance of Configurator.
58 59 60 |
# File 'lib/ridl/optparse_ext.rb', line 58 def initialize(set) @set = set end |
Instance Method Details
#on_exec(&block) ⇒ Object
62 63 64 65 66 |
# File 'lib/ridl/optparse_ext.rb', line 62 def on_exec(&block) ext_klass = class << @set; self; end ext_klass.send(:define_method, :_exec, &block) ext_klass.send(:protected, :_exec) end |
#with(param, options = {}) ⇒ Object
68 69 70 |
# File 'lib/ridl/optparse_ext.rb', line 68 def with(param, = {}) @set.define_params({param => }) end |
#without(*params) ⇒ Object
72 73 74 |
# File 'lib/ridl/optparse_ext.rb', line 72 def without(*params) params.each {|p| @set.params.delete(p.to_sym) } end |