Class: Igniter::Contracts::Contractable::Observation
- Inherits:
-
Struct
- Object
- Struct
- Igniter::Contracts::Contractable::Observation
- Defined in:
- lib/igniter/contracts/contractable.rb
Instance Attribute Summary collapse
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#name ⇒ Object
Returns the value of attribute name.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(name:, value:, metadata: {}) ⇒ Observation
constructor
A new instance of Observation.
- #to_h ⇒ Object
Constructor Details
#initialize(name:, value:, metadata: {}) ⇒ Observation
Returns a new instance of Observation.
7 8 9 10 |
# File 'lib/igniter/contracts/contractable.rb', line 7 def initialize(name:, value:, metadata: {}) super(name: name.to_sym, value: value, metadata: .dup.freeze) freeze end |
Instance Attribute Details
#metadata ⇒ Object
Returns the value of attribute metadata
6 7 8 |
# File 'lib/igniter/contracts/contractable.rb', line 6 def @metadata end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/igniter/contracts/contractable.rb', line 6 def name @name end |
#value ⇒ Object
Returns the value of attribute value
6 7 8 |
# File 'lib/igniter/contracts/contractable.rb', line 6 def value @value end |
Instance Method Details
#to_h ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/igniter/contracts/contractable.rb', line 12 def to_h { name: name, value: value, metadata: .dup } end |