module ItegrationAttr

Public Instance Methods

get_itgt_var(name,default=[]) click to toggle source
# File lib/tdl/exlib/itegration_verb.rb, line 3
def get_itgt_var(name,default=[])
    unless instance_variable_get("@_#{name}_")
        instance_variable_set("@_#{name}_",default)
        container = instance_variable_get("@_#{name}_")
    else
        container = instance_variable_get("@_#{name}_")
    end

    return container
end
has_attr(*names) click to toggle source
# File lib/tdl/exlib/itegration_verb.rb, line 123
def has_attr(*names)
    link_explort(*names)
end
has_flag(*names) click to toggle source
# File lib/tdl/exlib/itegration_verb.rb, line 127
def has_flag(*names)
    ## 标识控制
    container = get_itgt_var('itegration_flag_collect',[])
    container = container | names.map{ |e| e.to_s }
    set_itgt_var("itegration_flag_collect",container)
end
itegration_explort() click to toggle source
# File lib/tdl/exlib/itegration_verb.rb, line 28
def itegration_explort
    instance_variable_get("@_itegration_explort_collect_")
end
itegration_hash() click to toggle source
# File lib/tdl/exlib/itegration_verb.rb, line 20
def itegration_hash
    instance_variable_get("@_itegration_link_hash_")
end
param(name,default) click to toggle source
# File lib/tdl/exlib/itegration_verb.rb, line 219
def param(name,default)
    ## param_hash
    # itgt_param_hash = get_itgt_var('itgt_param_hash',{})
    # itgt_param_hash[name.to_s] = default
    # set_itgt_var('itgt_param_hash',itgt_param_hash)
    ## 生成实例方法
    self.class_exec do
        define_method(name) do
            # ItegrationVerb[name]
            itgt_param_hash = get_itgt_var('itgt_param_hash',{})
            if itgt_param_hash[name.to_s]
                return itgt_param_hash[name.to_s]
            else
                itgt_param_hash[name.to_s] = default
                set_itgt_var('itgt_param_hash',itgt_param_hash)
                return default
            end
        end

        define_method("#{name}=") do |value|
            # ItegrationVerb[name]
            itgt_param_hash = get_itgt_var('itgt_param_hash',{})
            itgt_param_hash[name.to_s] = value
            set_itgt_var('itgt_param_hash',itgt_param_hash)
            value
        end
    end
end
set_itgt_var(name,value) click to toggle source
# File lib/tdl/exlib/itegration_verb.rb, line 14
def set_itgt_var(name,value)
    # rel = get_itgt_var(name)
    instance_variable_set("@_#{name}_",value)
    container = instance_variable_get("@_#{name}_")
end