Class: XRay::SubMeta

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

Constructor Details

#initialize(entity) ⇒ SubMeta

Returns a new instance of SubMeta.



30
31
32
33
# File 'lib/aws-xray-sdk/model/metadata.rb', line 30

def initialize(entity)
  @data = {}
  @entity = entity
end

Instance Method Details

#[](key) ⇒ Object



35
36
37
# File 'lib/aws-xray-sdk/model/metadata.rb', line 35

def [](key)
  @data[key]
end

#[]=(k, v) ⇒ Object

Raises:



39
40
41
42
# File 'lib/aws-xray-sdk/model/metadata.rb', line 39

def []=(k, v)
  raise EntityClosedError if @entity.closed?
  @data[k] = v
end

#to_hObject



49
50
51
# File 'lib/aws-xray-sdk/model/metadata.rb', line 49

def to_h
  @data
end

#to_jsonObject



53
54
55
56
57
# File 'lib/aws-xray-sdk/model/metadata.rb', line 53

def to_json
  @to_json ||= begin
    MultiJson.dump to_h
  end
end

#update(h) ⇒ Object

Raises:



44
45
46
47
# File 'lib/aws-xray-sdk/model/metadata.rb', line 44

def update(h)
  raise EntityClosedError if @entity.closed?
  @data.merge!(h)
end