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



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

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.



28
29
30
# File 'lib/tdl/exlib/itegration.rb', line 28

def itgt
  @itgt
end

#nicknameObject

Returns the value of attribute nickname.



28
29
30
# File 'lib/tdl/exlib/itegration.rb', line 28

def nickname
  @nickname
end

Instance Method Details

#use_self(a) ⇒ Object



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

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

#use_selfs(*a) ⇒ Object



53
54
55
56
57
# File 'lib/tdl/exlib/itegration.rb', line 53

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