Class: NameSPoolHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/tdl/exlib/itegration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_id, *arguments) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/tdl/exlib/itegration.rb', line 57

def method_missing(method_id, *arguments)
    m0 = method_id.match(/(?<name>.+)\s*=/)
    # m_self = method_id.match(/^self_(?<name>.+)/)
    # m1 = method_id.match(/(?<name>.+)\s*=/)
    # if m_self
    #     send("[]=",m_self[:name],m_self[:name])
    # elsif m0
    if m0
        # if has_key?(m0[:name])
        # old_assign(m0[:name],arguments[0])
        send("[]=",m0[:name],arguments[0])
    elsif  has_key?(method_id.to_s)
        send("[]",method_id)
    else
        raise TdlError.new("Itegration dont has name #{method_id} in names_pool")
    end
end

Instance Attribute Details

#itgtObject

Returns the value of attribute itgt.



26
27
28
# File 'lib/tdl/exlib/itegration.rb', line 26

def itgt
  @itgt
end

#nicknameObject

Returns the value of attribute nickname.



26
27
28
# File 'lib/tdl/exlib/itegration.rb', line 26

def nickname
  @nickname
end

Instance Method Details

#use_self(a) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/tdl/exlib/itegration.rb', line 42

def use_self(a)
    unless old_index(a.to_s)
        send("[]=",a,a)
        send("[]",a)
    else
        send("[]",a)
    end
end

#use_selfs(*a) ⇒ Object



51
52
53
54
55
# File 'lib/tdl/exlib/itegration.rb', line 51

def use_selfs(*a)
    a.each do |aa|
        use_self(aa)
    end
end