class TkNamespace::Ensemble - tk-0.2.0 Documentation

# class TkNamespace::Ensemble

### Public Class Methods

exist?(ensemble) click to toggle source

    # File lib/tk/namespace.rb, line 65
    def self.exist?(ensemble)
      bool(tk_call('namespace', 'ensemble', 'exists', ensemble))
    end

new(keys = {}) click to toggle source

    # File lib/tk/namespace.rb, line 69
    def initialize(keys = {})
      @ensemble = @path = tk_call('namespace', 'ensemble', 'create', keys)
    end

### Public Instance Methods

cget(slot) click to toggle source
Calls superclass method TkConfigMethod#cget

    # File lib/tk/namespace.rb, line 73
    def cget(slot)
      if slot == :namespace || slot == 'namespace'
        ns = super(slot)
        Tk_Namespace_ID_TBL.mutex.synchronize{
          if TkNamespace::Tk_Namespace_ID_TBL.key?(ns)
            TkNamespace::Tk_Namespace_ID_TBL[ns]
          else
            ns
          end
        }
      else
        super(slot)
      end
    end

cget_strict(slot) click to toggle source
Calls superclass method TkConfigMethod#cget_strict

    # File lib/tk/namespace.rb, line 87
    def cget_strict(slot)
      if slot == :namespace || slot == 'namespace'
        ns = super(slot)
        Tk_Namespace_ID_TBL.mutex.synchronize{
          if TkNamespace::Tk_Namespace_ID_TBL.key?(ns)
            TkNamespace::Tk_Namespace_ID_TBL[ns]
          else
            ns
          end
        }
      else
        super(slot)
      end
    end

configinfo(slot = nil) click to toggle source
Calls superclass method TkConfigMethod#configinfo

    # File lib/tk/namespace.rb, line 102
    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

exists?() click to toggle source

    # File lib/tk/namespace.rb, line 148
    def exists?
      bool(tk_call('namespace', 'ensemble', 'exists', @path))
    end

### Private Instance Methods

__boolval_optkeys() click to toggle source

    # File lib/tk/namespace.rb, line 55
    def __boolval_optkeys
      ['prefixes']
    end

__cget_cmd() click to toggle source

    # File lib/tk/namespace.rb, line 39
    def __cget_cmd
      ['namespace', 'ensemble', 'configure', self.path]
    end

__config_cmd() click to toggle source

    # File lib/tk/namespace.rb, line 44
    def __config_cmd
      ['namespace', 'ensemble', 'configure', self.path]
    end

__configinfo_struct() click to toggle source

    # File lib/tk/namespace.rb, line 49
    def __configinfo_struct
      {:key=>0, :alias=>nil, :db_name=>nil, :db_class=>nil,
        :default_value=>nil, :current_value=>2}
    end

__listval_optkeys() click to toggle source

    # File lib/tk/namespace.rb, line 60
    def __listval_optkeys
      ['map', 'subcommands', 'unknown']
    end