class IDL::OptionList::Option::Group::Configurator
Public Class Methods
new(grp)
click to toggle source
# File lib/ridl/optparse_ext.rb, line 152 def initialize(grp) @group = grp end
Public Instance Methods
define_param(id, options = {}, &block)
click to toggle source
# File lib/ridl/optparse_ext.rb, line 181 def define_param(id, options = {}, &block) define_param_set("#{id}_set", options) do |pscfg| pscfg.with(id) pscfg.on_exec(&block) end end
Also aliased as: for_param, with_param
define_param_set(id, options = {}, &block)
click to toggle source
# File lib/ridl/optparse_ext.rb, line 162 def define_param_set(id, options = {}, &block) id = id.to_sym raise "option parameter set [#{id}] already exists" if @group.sets.has_key?(id) @group.sets[id] = ParamSet.new(options) block.call(ParamSet::Configurator.new(@group.sets[id])) if block_given? end
Also aliased as: for_params
modify_param_set(id, options = {}, &block)
click to toggle source
# File lib/ridl/optparse_ext.rb, line 171 def modify_param_set(id, options = {}, &block) id = id.to_sym parms = options[:params] ? options.delete(:params) : options.delete(:param) @group.sets[id] ||= ParamSet.new(options) @group.sets[id].define_params(parms) if parms block.call(ParamSet::Configurator.new(@group.sets[id])) if block_given? end
Also aliased as: modify_params, with_params
on_prepare(&block)
click to toggle source
# File lib/ridl/optparse_ext.rb, line 156 def on_prepare(&block) ext_klass = class << @group; self; end ext_klass.send(:define_method, :_prepare, &block) ext_klass.send(:protected, :_prepare) end
without_param(id)
click to toggle source
# File lib/ridl/optparse_ext.rb, line 190 def without_param(id) @group.sets.delete("#{id}_set") end
Also aliased as: without_set, without_params