Class: ParamsReady::Parameter::StateDefinition
- Inherits:
-
StructParameterDefinition
- Object
- AbstractDefinition
- Definition
- AbstractStructParameterDefinition
- StructParameterDefinition
- ParamsReady::Parameter::StateDefinition
- Defined in:
- lib/params_ready/parameter/state.rb
Instance Attribute Summary collapse
-
#relations ⇒ Object
readonly
Returns the value of attribute relations.
Attributes inherited from AbstractStructParameterDefinition
Attributes inherited from Definition
Attributes inherited from AbstractDefinition
Instance Method Summary collapse
- #add_relation(relation) ⇒ Object
-
#initialize(*args, **opts) ⇒ StateDefinition
constructor
A new instance of StateDefinition.
Methods inherited from StructParameterDefinition
#add_map, #ensure_canonical, #remap?
Methods inherited from AbstractStructParameterDefinition
#add_child, #child_definition, #duplicate_value, #freeze_value, #has_child?, #infer_default, #set_default
Methods inherited from Definition
#canonical_default, #default_defined?, #fetch_callable_default, #fetch_default, #finish, #memoize?, #name_for_formatter, #no_input?, #no_output?, #postprocess, #preprocess, #restricted_for_format?, #set_local, #set_no_input, #set_postprocessor, #set_preprocessor
Methods inherited from AbstractDefinition
#create, #finish, #from_hash, #from_input, #normalize_alternative_name, #parameter_class
Methods included from Extensions::Freezer
#freeze_variable, #freeze_variables, #variables_to_freeze
Methods included from Extensions::Finalizer
Methods included from Extensions::ClassReaderWriter
Methods included from Extensions::LateInit
Methods included from Extensions::Collection
Methods included from Extensions::Finalizer::InstanceMethods
Methods included from Extensions::Freezer::InstanceMethods
Constructor Details
#initialize(*args, **opts) ⇒ StateDefinition
Returns a new instance of StateDefinition.
116 117 118 119 |
# File 'lib/params_ready/parameter/state.rb', line 116 def initialize(*args, **opts) super *args, **opts @relations = Set.new end |
Instance Attribute Details
#relations ⇒ Object (readonly)
Returns the value of attribute relations.
114 115 116 |
# File 'lib/params_ready/parameter/state.rb', line 114 def relations @relations end |
Instance Method Details
#add_relation(relation) ⇒ Object
121 122 123 124 125 126 127 |
# File 'lib/params_ready/parameter/state.rb', line 121 def add_relation(relation) if @relations.include? relation.name raise ParamsReadyError, "Relation already there '#{relation.name}'" end @relations << relation.name add_child relation end |