Method: TkConfigMethod#current_configinfo

Defined in:
lib/tk.rb

#current_configinfo(slot = nil) ⇒ Object



4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
# File 'lib/tk.rb', line 4804

def current_configinfo(slot = nil)
  if TkComm::GET_CONFIGINFO_AS_ARRAY
    if slot
      org_slot = slot
      begin
        conf = configinfo(slot)
        if ( ! __configinfo_struct[:alias] \
            || conf.size > __configinfo_struct[:alias] + 1 )
          return {conf[0] => conf[-1]}
        end
        slot = conf[__configinfo_struct[:alias]]
      end while(org_slot != slot)
      fail RuntimeError,
        "there is a configure alias loop about '#{org_slot}'"
    else
      ret = {}
      configinfo().each{|cnf|
        if ( ! __configinfo_struct[:alias] \
            || cnf.size > __configinfo_struct[:alias] + 1 )
          ret[cnf[0]] = cnf[-1]
        end
      }
      ret
    end
  else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
    ret = {}
    configinfo(slot).each{|key, cnf|
      ret[key] = cnf[-1] if cnf.kind_of?(Array)
    }
    ret
  end
end