Class: ParamsReady::Parameter::EnumSetParameterBuilder

Inherits:
Builder show all
Includes:
Marshaller::BuilderModule
Defined in:
lib/params_ready/parameter/enum_set_parameter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Marshaller::BuilderModule

#marshal

Methods inherited from Builder

#helper

Methods inherited from AbstractBuilder

#build, builder, define_parameter, define_registered_parameter, #fetch, fetch_builder, #include, #initialize, #open?, register, register_deprecated

Methods included from Extensions::Registry

#human_string, #registry

Constructor Details

This class inherits a constructor from ParamsReady::AbstractBuilder

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