Class: Origen::Parameters::Missing

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Missing

Returns a new instance of Missing.



15
16
17
# File 'lib/origen/parameters/missing.rb', line 15

def initialize(options = {})
  @owner = options[: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

#ownerObject (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

#contextObject



19
20
21
# File 'lib/origen/parameters/missing.rb', line 19

def context
  owner._parameter_current
end