Class: Lore::Attribute_Hash

Inherits:
Hash
  • Object
show all
Defined in:
lib/lore/table_instance.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Hash

#deep_merge!, #keys_flat, #merge_nested_hash!, #nested_hash

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(key) ⇒ Object



34
35
36
# File 'lib/lore/table_instance.rb', line 34

def method_missing(key) 
  self[key]
end

Instance Method Details

#[](key) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/lore/table_instance.rb', line 13

def [](key)
  if !random_access_op(key).nil? then
    return random_access_op(key)
  elsif !random_access_op(key.to_s).nil? then
    return random_access_op(key.to_s)
  else
    skey = key.to_s[0..24].intern
    return random_access_op(skey)
  end
end

#[]=(key, value) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/lore/table_instance.rb', line 24

def []=(key, value)
  begin
    key = key.to_s[0..24].intern
  rescue ::Exception => excep
    Lore.logger.debug { 'Error when trying to access key ' << key.inspect }
    raise excep
  end
  self.random_access_assign_op(key, value)
end

#random_access_assign_opObject



12
# File 'lib/lore/table_instance.rb', line 12

alias random_access_assign_op []=

#random_access_opObject



11
# File 'lib/lore/table_instance.rb', line 11

alias random_access_op []