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.



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

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.



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

def dsize
  @dsize
end

Instance Method Details

#-(name, dsize: nil) ⇒ Object



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

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

#[](*a) ⇒ Object



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

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