Class: XRay::SubMeta
- Inherits:
-
Object
- Object
- XRay::SubMeta
- Defined in:
- lib/aws-xray-sdk/model/metadata.rb
Overview
The actual class that stores all data under a certain namespace.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(k, v) ⇒ Object
-
#initialize(entity) ⇒ SubMeta
constructor
A new instance of SubMeta.
- #to_h ⇒ Object
- #to_json ⇒ Object
- #update(h) ⇒ Object
Constructor Details
#initialize(entity) ⇒ SubMeta
Returns a new instance of SubMeta.
26 27 28 29 |
# File 'lib/aws-xray-sdk/model/metadata.rb', line 26 def initialize(entity) @data = {} @entity = entity end |
Instance Method Details
#[](key) ⇒ Object
31 32 33 |
# File 'lib/aws-xray-sdk/model/metadata.rb', line 31 def [](key) @data[key] end |
#[]=(k, v) ⇒ Object
35 36 37 38 |
# File 'lib/aws-xray-sdk/model/metadata.rb', line 35 def []=(k, v) raise EntityClosedError if @entity.closed? @data[k] = v end |
#to_h ⇒ Object
45 46 47 |
# File 'lib/aws-xray-sdk/model/metadata.rb', line 45 def to_h @data end |
#to_json ⇒ Object
49 50 51 52 53 |
# File 'lib/aws-xray-sdk/model/metadata.rb', line 49 def to_json @to_json ||= begin Oj.dump to_h, mode: :compat, use_as_json: true end end |
#update(h) ⇒ Object
40 41 42 43 |
# File 'lib/aws-xray-sdk/model/metadata.rb', line 40 def update(h) raise EntityClosedError if @entity.closed? @data.merge!(h) end |