Class: Origen::Parameters::Missing
- Defined in:
- lib/origen/parameters/missing.rb
Overview
An instance of this class is returned whenever the parameter context is set to a value for which no parameter set has been defined.
Sometime this may be valid in the case where the context is actually implemented by another object which shadows the context.
The missing allows the user to do params.context to retrieve the value of the current context, but it will error out with a useful error message if they try to do anything else (i.e. retrieve a parameter from it)
Instance Attribute Summary collapse
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
Instance Method Summary collapse
- #context ⇒ Object
-
#initialize(options = {}) ⇒ Missing
constructor
A new instance of Missing.
- #method_missing(_method, *_args, &_block) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Missing
Returns a new instance of Missing.
15 16 17 |
# File 'lib/origen/parameters/missing.rb', line 15 def initialize( = {}) @owner = [:owner] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(_method, *_args, &_block) ⇒ Object
23 24 25 |
# File 'lib/origen/parameters/missing.rb', line 23 def method_missing(_method, *_args, &_block) owner.send(:_validate_parameter_set_name, context) end |
Instance Attribute Details
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
13 14 15 |
# File 'lib/origen/parameters/missing.rb', line 13 def owner @owner end |
Instance Method Details
#context ⇒ Object
19 20 21 |
# File 'lib/origen/parameters/missing.rb', line 19 def context owner._parameter_current end |