Class: Larynx::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/larynx/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Session

Returns a new instance of Session.



5
6
7
# File 'lib/larynx/session.rb', line 5

def initialize(data)
  @variables = data
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



9
10
11
12
13
# File 'lib/larynx/session.rb', line 9

def method_missing(method, *args, &block)
  if @variables.has_key?(method.to_sym)
    @variables[method.to_sym]
  end
end

Instance Attribute Details

#variablesObject (readonly)

Returns the value of attribute variables.



3
4
5
# File 'lib/larynx/session.rb', line 3

def variables
  @variables
end

Instance Method Details

#[](key) ⇒ Object



19
20
21
# File 'lib/larynx/session.rb', line 19

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

#[]=(key, value) ⇒ Object



15
16
17
# File 'lib/larynx/session.rb', line 15

def []=(key, value)
  @variables[key] = value
end