Class: TraceViz::Context::Map

Inherits:
Object
  • Object
show all
Defined in:
lib/trace_viz/context/map.rb

Instance Method Summary collapse

Constructor Details

#initializeMap

Returns a new instance of Map.



6
7
8
# File 'lib/trace_viz/context/map.rb', line 6

def initialize
  @context_map = {}
end

Instance Method Details

#fetch(key) ⇒ Object



14
15
16
17
18
# File 'lib/trace_viz/context/map.rb', line 14

def fetch(key)
  @context_map.fetch(key)
rescue KeyError
  raise ContextError, "Context for key '#{key}' not found"
end

#remove(*keys) ⇒ Object



20
21
22
# File 'lib/trace_viz/context/map.rb', line 20

def remove(*keys)
  keys.each { |key| @context_map.delete(key) }
end

#replace(new_map) ⇒ Object



10
11
12
# File 'lib/trace_viz/context/map.rb', line 10

def replace(new_map)
  @context_map = new_map
end

#resetObject



24
25
26
# File 'lib/trace_viz/context/map.rb', line 24

def reset
  @context_map.clear
end