Method: TkNamespace::Ensemble#configinfo

Defined in:
lib/tk/namespace.rb

#configinfo(slot = nil) ⇒ Object



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/tk/namespace.rb', line 101

def configinfo(slot = nil)
  if slot
    if slot == :namespace || slot == 'namespace'
      val = super(slot)
      Tk_Namespace_ID_TBL.mutex.synchronize{
        if TkNamespace::Tk_Namespace_ID_TBL.key?(val)
          val = TkNamespace::Tk_Namespace_ID_TBL[val]
        end
      }
    else
      val = super(slot)
    end

    if TkComm::GET_CONFIGINFO_AS_ARRAY
      [slot.to_s, val]
    else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
      {slot.to_s => val}
    end

  else
    info = super()

    if TkComm::GET_CONFIGINFO_AS_ARRAY
      Tk_Namespace_ID_TBL.mutex.synchronize{
        info.map!{|inf|
          if inf[0] == 'namespace' &&
              TkNamespace::Tk_Namespace_ID_TBL.key?(inf[-1])
            [inf[0], TkNamespace::Tk_Namespace_ID_TBL[inf[-1]]]
          else
            inf
          end
        }
      }
    else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
      val = info['namespace']
      Tk_Namespace_ID_TBL.mutex.synchronize{
        if TkNamespace::Tk_Namespace_ID_TBL.key?(val)
          info['namespace'] = TkNamespace::Tk_Namespace_ID_TBL[val]
        end
      }
    end

    info
  end
end