Module: Idolent

Defined in:
lib/idolent.rb

Defined Under Namespace

Modules: LazyClassMethods Classes: LazyArray, LazyHash

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#variablesObject (readonly)

Returns the value of attribute variables.



2
3
4
# File 'lib/idolent.rb', line 2

def variables
  @variables
end

Class Method Details

.included(base) ⇒ Object



4
5
6
# File 'lib/idolent.rb', line 4

def self.included(base)
  base.extend(LazyClassMethods)
end

Instance Method Details

#initialize(variables = {}) ⇒ Object



8
9
10
# File 'lib/idolent.rb', line 8

def initialize(variables = {})
  @variables = variables
end

#read_variable(variable) ⇒ Object



12
13
14
15
16
# File 'lib/idolent.rb', line 12

def read_variable(variable)
  return @variables[variable.to_s] if @variables.has_key?(variable.to_s)
  return @variables[variable.to_sym] if @variables.has_key?(variable.to_sym)
  return nil
end

#update_variable(variable, value) ⇒ Object



18
19
20
21
# File 'lib/idolent.rb', line 18

def update_variable(variable, value)
  @variables[variable.to_s] = value if @variables.has_key?(variable.to_s)
  @variables[variable.to_sym] = value if @variables.has_key?(variable.to_sym)
end