Class: ParamsReady::Parameter::PolymorphParameterBuilder

Inherits:
Builder show all
Includes:
Marshaller::BuilderModule
Defined in:
lib/params_ready/parameter/polymorph_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, resolve

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) ⇒ Object



80
81
82
# File 'lib/params_ready/parameter/polymorph_parameter.rb', line 80

def self.instance(name, altn: nil)
  new PolymorphParameterDefinition.new(name, altn: altn)
end

Instance Method Details

#identifier(identifier) ⇒ Object



89
90
91
# File 'lib/params_ready/parameter/polymorph_parameter.rb', line 89

def identifier(identifier)
  @definition.set_identifier identifier
end

#type(input, *args, **opts, &block) ⇒ Object



84
85
86
87
# File 'lib/params_ready/parameter/polymorph_parameter.rb', line 84

def type(input, *args, **opts, &block)
  definition = self.class.resolve(input, *args, **opts, &block)
  @definition.add_type definition
end