Class: Onuro::Context

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Context

Returns a new instance of Context.



15
16
17
18
# File 'lib/onuro/context.rb', line 15

def initialize(**options)
  @data = Hash.new(0)
  @data.merge!(options)
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/onuro/context.rb', line 5

def data
  @data
end

Instance Method Details

#[](key) ⇒ Object



7
8
9
# File 'lib/onuro/context.rb', line 7

def [](key)
  data[key]
end

#[]=(key, value) ⇒ Object



11
12
13
# File 'lib/onuro/context.rb', line 11

def []=(key, value)
  data[key] = value
end

#add(key, value) ⇒ Object



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

def add(key, value)
  data[key] = value
end