Class: DefLib
Instance Attribute Summary
Attributes inherited from ErbPP
Instance Method Summary collapse
- #cumo_id_assign ⇒ Object
- #cumo_id_decl ⇒ Object
- #def_class(**opts, &block) ⇒ Object
- #def_module(**opts, &block) ⇒ Object
-
#initialize(parent = nil, **opts, &block) ⇒ DefLib
constructor
A new instance of DefLib.
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 = nil, **opts, &block) ⇒ DefLib
Returns a new instance of DefLib.
124 125 126 127 128 |
# File 'ext/cumo/narray/gen/erbpp2.rb', line 124 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
#cumo_id_assign ⇒ Object
129 130 131 132 133 |
# File 'ext/cumo/narray/gen/erbpp2.rb', line 129 def cumo_id_assign ids = [] @children.each { |c| a = c.get(:cumo_id_list); ids.concat(a) if a } ids.sort.uniq.map { |x| "cumo_id_#{x[1]} = rb_intern(\"#{x[0]}\");" } end |
#cumo_id_decl ⇒ Object
134 135 136 137 138 |
# File 'ext/cumo/narray/gen/erbpp2.rb', line 134 def cumo_id_decl ids = [] @children.each { |c| a = c.get(:cumo_id_list); ids.concat(a) if a } ids.sort.uniq.map { |x| "static ID cumo_id_#{x[1]};\n" } end |