Module: Tk::ValidateConfigure

Module | Tk::ValidateConfigure
In: | tk/lib/tk/validation.rb

### Methods

__conv_vcmd_on_hash_kv __def_validcmd __get_validate_key2class __validation_class_list __validcmd_call configure

### Public Class methods

__def_validcmd(scope, klass, keys=nil)

[Source]

    # File tk/lib/tk/validation.rb, line 8
        def self.__def_validcmd(scope, klass, keys=nil)
          keys = klass._config_keys unless keys
          keys.each{|key|
            eval("def #{key}(*args, &b)
                     __validcmd_call(#{klass.name}, '#{key}', *args, &b)
                  end", scope)
          }
        end

### Public Instance methods

__conv_vcmd_on_hash_kv(keys)

[Source]

    # File tk/lib/tk/validation.rb, line 46
        def __conv_vcmd_on_hash_kv(keys)
          key2class = __get_validate_key2class

          keys = _symbolkey2str(keys)
          key2class.each{|key, klass|
            if keys[key].kind_of?(Array)
              cmd, *args = keys[key]
              keys[key] = klass.new(cmd, args.join(' '))
            # elsif keys[key].kind_of?(Proc) ||  keys[key].kind_of?(Method)
            elsif TkComm._callback_entry?(keys[key])
              keys[key] = klass.new(keys[key])
            end
          }
          keys
        end

__get_validate_key2class()

[Source]

    # File tk/lib/tk/validation.rb, line 36
        def __get_validate_key2class
          k2c = {}
          __validation_class_list.each{|klass|
            klass._config_keys.each{|key|
              k2c[key.to_s] = klass
            }
          }
          k2c
        end

__validation_class_list()

[Source]

    # File tk/lib/tk/validation.rb, line 31
        def __validation_class_list
          # maybe need to override
          []
        end

__validcmd_call(klass, key, *args, &b)

[Source]

    # File tk/lib/tk/validation.rb, line 17
        def __validcmd_call(klass, key, *args, &b)
          return cget(key) if args.empty? && !b

          cmd = (b)? proc(&b) : args.shift

          if cmd.kind_of?(klass)
            configure(key, cmd)
          elsif !args.empty?
            configure(key, [cmd, args])
          else
            configure(key, cmd)
          end
        end

configure(slot, value=TkComm::None)

[Source]

    # File tk/lib/tk/validation.rb, line 67
        def configure(slot, value=TkComm::None)
          if slot.kind_of?(Hash)
            super(__conv_vcmd_on_hash_kv(slot))
          else
            super(__conv_vcmd_on_hash_kv(slot=>value))
          end
          self
        end

[Validate]