Class: ParamsReady::Parameter::HashSetParameterBuilder
Class Method Summary
collapse
Instance Method Summary
collapse
#marshal
Methods inherited from Builder
#helper
#build, define_parameter, define_registered_parameter, #fetch, #include, #initialize, #open?, register
#human_string, #registry
Class Method Details
.instance(name, altn: nil, type: :boolean) ⇒ Object
39
40
41
|
# File 'lib/params_ready/parameter/hash_set_parameter.rb', line 39
def self.instance(name, altn: nil, type: :boolean)
new HashSetParameterDefinition.new(name, altn: altn, type: type)
end
|
.resolve(type, input, *args, **opts, &block) ⇒ Object
50
51
52
53
54
55
56
|
# File 'lib/params_ready/parameter/hash_set_parameter.rb', line 50
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
43
44
45
46
47
|
# File 'lib/params_ready/parameter/hash_set_parameter.rb', line 43
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
|