Class: DefLib
- Inherits:
-
ErbPP
show all
- Defined in:
- ext/numo/narray/gen/erbpp2.rb
Constant Summary
Constants inherited
from ErbPP
ErbPP::ATTRS
Instance Attribute Summary
Attributes inherited from ErbPP
#children, #parent
Instance Method Summary
collapse
Methods inherited from ErbPP
#add_child, #attr_method, #attrs, #check_params, define_attrs, #description, #find, #find_tmpl, #get, #has_attr?, #init_def, #load_erb, #method_missing, #method_missing_alias, #parents, #result, #run, #search_method_in_parents, #set, #write
Constructor Details
#initialize(parent = nil, **opts, &block) ⇒ DefLib
Returns a new instance of DefLib.
110
111
112
113
114
|
# File 'ext/numo/narray/gen/erbpp2.rb', line 110
def initialize(parent=nil, **opts, &block)
opts[:erb_base] ||= 'lib'
opts[:include_files] ||= []
super(parent, **opts, &block)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class ErbPP
Instance Method Details
#def_class(**opts, &block) ⇒ Object
125
126
127
|
# File 'ext/numo/narray/gen/erbpp2.rb', line 125
def def_class(**opts, &block)
DefClass.new(self, **opts, &block)
end
|
#def_module(**opts, &block) ⇒ Object
128
129
130
|
# File 'ext/numo/narray/gen/erbpp2.rb', line 128
def def_module(**opts, &block)
DefModule.new(self, **opts, &block)
end
|
#id_assign ⇒ Object
115
116
117
118
119
|
# File 'ext/numo/narray/gen/erbpp2.rb', line 115
def id_assign
ids = []
@children.each{|c| a=c.get(:id_list); ids.concat(a) if a}
ids.sort.uniq.map{|x| "id_#{x[1]} = rb_intern(\"#{x[0]}\");"}
end
|
#id_decl ⇒ Object
120
121
122
123
124
|
# File 'ext/numo/narray/gen/erbpp2.rb', line 120
def id_decl
ids = []
@children.each{|c| a=c.get(:id_list); ids.concat(a) if a}
ids.sort.uniq.map{|x| "static ID id_#{x[1]};\n"}
end
|