Class: ClassHDL::ImplicitInstModule

Inherits:
Object
  • Object
show all
Defined in:
lib/tdl/class_hdl/hdl_module_def.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, sdlm) ⇒ ImplicitInstModule

Returns a new instance of ImplicitInstModule.



70
71
72
73
# File 'lib/tdl/class_hdl/hdl_module_def.rb', line 70

def initialize(name,sdlm)
    @name = name
    @sdlm = sdlm
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(dname, *args, &block) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/tdl/class_hdl/hdl_module_def.rb', line 88

def method_missing(dname,*args,&block)
    # if dname !~ /\w+/
    #     raise TDLError.new("#{@name} cont instance name #{dname}")
    # end

    # if $_implicit_curr_itgt_.last 
    #     @sdlm.Itgt_Instance(@name,dname.to_s.to_inp,&block)
    # else 
    #     @sdlm.Instance(@name,dname.to_s,&block)
    # end
    AssignDefOpertor.with_rollback_opertors(:old) do 
        inst(dname,&block)
    end
end

Instance Method Details

#inst(dname, &block) ⇒ Object



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/tdl/class_hdl/hdl_module_def.rb', line 75

def inst(dname,&block)
    if dname !~ /\w+/
        raise TdlError.new("#{@name} cont instance name #{dname}")
    end

    ## 有必要加一级封装代理
    if $_implicit_curr_itgt_.slast 
        @sdlm.Itgt_Instance(@name,dname.to_s.to_inp,&block)
    else 
        @sdlm.Instance(@name,dname.to_s,&block)
    end
end