Class: TdlSpace::DefDataInf_ArrayChain

Inherits:
DefArrayChain show all
Defined in:
lib/tdl/sdlmodule/sdlmodule_arraychain.rb

Instance Attribute Summary collapse

Attributes inherited from DefArrayChain

#belong_to_module, #chain

Instance Method Summary collapse

Methods inherited from DefArrayChain

#check_name, #check_topmodule_method, #method_missing, #to_inp

Constructor Details

#initialize(belong_to_module: nil, dsize: 8) ⇒ DefDataInf_ArrayChain

Returns a new instance of DefDataInf_ArrayChain.



154
155
156
157
# File 'lib/tdl/sdlmodule/sdlmodule_arraychain.rb', line 154

def initialize(belong_to_module: nil,dsize: 8)
    super(belong_to_module)
    @dsize = dsize 
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TdlSpace::DefArrayChain

Instance Attribute Details

#dsizeObject

Returns the value of attribute dsize.



153
154
155
# File 'lib/tdl/sdlmodule/sdlmodule_arraychain.rb', line 153

def dsize
  @dsize
end

Instance Method Details

#-(name, dsize: nil) ⇒ Object



168
169
170
171
# File 'lib/tdl/sdlmodule/sdlmodule_arraychain.rb', line 168

def -(name,dsize: nil )
    name = to_inp(name)
    belong_to_module.Def.datainf_c(name: name ,dsize: dsize||@dsize,dimension: @chain)
end

#[](*a) ⇒ Object



159
160
161
162
163
164
165
166
# File 'lib/tdl/sdlmodule/sdlmodule_arraychain.rb', line 159

def [](*a)
    if a.empty?
        raise TdlError.new("参数不能为空")
    end
    new_dla = self.class.new(belong_to_module: @belong_to_module,dsize: @dsize)
    new_dla.chain = @chain + a
    new_dla
end