Class: Const

Inherits:
ErbPP show all
Defined in:
lib/erbpp.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, name, value, desc) ⇒ Const

Returns a new instance of Const.



278
279
280
281
282
283
284
# File 'lib/erbpp.rb', line 278

def initialize(parent,name,value,desc)
  super(parent,nil)
  @name = name
  @value = value
  @desc = desc
  Function::DEFS.push(self)
end

Dynamic Method Handling

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

Instance Method Details

#codeObject



286
287
288
# File 'lib/erbpp.rb', line 286

def code
  nil
end

#definitionObject



290
291
292
293
# File 'lib/erbpp.rb', line 290

def definition
  "/*"+desc+"*/\n    "+
    "rb_define_const(#{mod_var},\"#{name}\",#{value});"
end