Class: DefClass

Inherits:
DefModule show all
Defined in:
ext/cumo/narray/gen/erbpp2.rb

Instance Attribute Summary

Attributes inherited from ErbPP

#children, #parent

Instance Method Summary collapse

Methods inherited from DefModule

#cumo_id_list, #def_id, #init_def, #method_code

Methods included from DeclMethod

#def_alias, #def_alloc_func, #def_const, #def_method, #def_module_function, #def_singleton_method, #undef_alloc_func, #undef_method, #undef_singleton_method

Methods inherited from ErbPP

#add_child, #description, #find, #find_tmpl, #get, #init_def, #load_erb, #method_missing, #method_missing_alias, #result, #run, #set, #write

Constructor Details

#initialize(parent, **opts, &block) ⇒ DefClass

Returns a new instance of DefClass.



205
206
207
208
# File 'ext/cumo/narray/gen/erbpp2.rb', line 205

def initialize(parent, **opts, &block)
  eb = opts[:erb_base] || 'class'
  super(parent, erb_base:eb, **opts, &block)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ErbPP

Instance Method Details

#_mod_varObject



209
210
211
# File 'ext/cumo/narray/gen/erbpp2.rb', line 209

def _mod_var
  @opts[:class_var]
end

#free_funcObject



218
219
220
# File 'ext/cumo/narray/gen/erbpp2.rb', line 218

def free_func
  @opts[:free_func] || "gsl_" + get(:name) + "_free"
end

#init_erbObject



212
213
214
# File 'ext/cumo/narray/gen/erbpp2.rb', line 212

def init_erb
  @opts[:init_erb] || "init_class"
end

#super_classObject



215
216
217
# File 'ext/cumo/narray/gen/erbpp2.rb', line 215

def super_class
  @opts[:super_class] || "rb_cObject"
end