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.
57 58 59 |
# File 'lib/ridl/optparse_ext.rb', line 57 def initialize(set) @set = set end |
Instance Method Details
#on_exec(&block) ⇒ Object
61 62 63 64 65 |
# File 'lib/ridl/optparse_ext.rb', line 61 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
67 68 69 |
# File 'lib/ridl/optparse_ext.rb', line 67 def with(param, = {}) @set.define_params({param => }) end |
#without(*params) ⇒ Object
71 72 73 |
# File 'lib/ridl/optparse_ext.rb', line 71 def without(*params) params.each {|p| @set.params.delete(p.to_sym) } end |