Class: DefGslClass

Inherits:
DefClass show all
Includes:
ErbppGsl
Defined in:
ext/numo/gsl/gen/erbpp_gsl.rb

Instance Attribute Summary

Attributes inherited from ErbPP

#children, #parent

Instance Method Summary collapse

Methods included from ErbppGsl

FM, dbl, dblp, int, intp, long, read_const, read_enum, read_eval, read_func, read_func_pattern, read_type, str, szt, sztp, tp, uint, ulong, void

Methods inherited from DefClass

#_mod_var, #free_func, #init_erb, #initialize, #super_class

Methods inherited from DefModule

#_mod_var, #def_id, #id_list, #init_def, #init_erb, #initialize, #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, #initialize, #load_erb, #method_missing, #method_missing_alias, #result, #run, #set, #write

Constructor Details

This class inherits a constructor from DefClass

Dynamic Method Handling

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

Instance Method Details

#check_func(h) ⇒ Object



108
109
110
111
112
113
114
115
116
117
118
# File 'ext/numo/gsl/gen/erbpp_gsl.rb', line 108

def check_func(h)
  fn = h[:func_name]
  if t = lookup(h)
    m = to_method_name(fn)
    define_method(t, name:m, **h)
  elsif /_free$/ =~ fn
    set free_func: fn
  else
    $stderr.puts "skip #{fn}"
  end
end

#define_method(t, **h) ⇒ Object



124
125
126
# File 'ext/numo/gsl/gen/erbpp_gsl.rb', line 124

def define_method(t,**h)
  DefGslMethod.new(self, t, **h)
end

#lookup(h) ⇒ Object

Raises:

  • (NotImplementedError)


103
104
105
106
# File 'ext/numo/gsl/gen/erbpp_gsl.rb', line 103

def lookup(h)
  # implement in Subclass
  raise NotImplementedError
end

#to_method_name(s) ⇒ Object



120
121
122
# File 'ext/numo/gsl/gen/erbpp_gsl.rb', line 120

def to_method_name(s)
  s.sub(/^gsl_#{name}_/,"")
end