Class: ParamsReady::Parameter::EnumSetParameterBuilder
Class Method Summary
collapse
Instance Method Summary
collapse
#marshal
Methods inherited from Builder
#helper
#build, builder, define_parameter, define_registered_parameter, #fetch, fetch_builder, #include, #initialize, #open?, register, register_deprecated
#human_string, #registry
Class Method Details
.instance(name, altn: nil, type: :boolean) ⇒ Object
40
41
42
|
# File 'lib/params_ready/parameter/enum_set_parameter.rb', line 40
def self.instance(name, altn: nil, type: :boolean)
new EnumSetParameterDefinition.new(name, altn: altn, type: type)
end
|
.resolve(type, input, *args, **opts, &block) ⇒ Object
51
52
53
54
55
56
57
|
# File 'lib/params_ready/parameter/enum_set_parameter.rb', line 51
def self.resolve(type, input, *args, **opts, &block)
if input.is_a? AbstractDefinition
input
else
define_registered_parameter(type, input, *args, **opts, &block)
end
end
|
Instance Method Details
#add(input, *args, val: nil, **opts, &block) ⇒ Object
44
45
46
47
48
|
# File 'lib/params_ready/parameter/enum_set_parameter.rb', line 44
def add(input, *args, val: nil, **opts, &block)
type = @definition.type
definition = self.class.resolve(type, input, *args, **opts, &block)
@definition.add_child definition, value: val
end
|