Class: RGhost::Function
Overview
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name, body_function = nil, &block) ⇒ Function
constructor
A new instance of Function.
- #ps ⇒ Object
- #use_template(function_name) ⇒ Object
Methods inherited from PsObject
#<<, #call, #graphic_scope, #raw, #set, #to_s
Constructor Details
#initialize(name, body_function = nil, &block) ⇒ Function
Returns a new instance of Function.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rghost/function.rb', line 14 def initialize(name,body_function=nil,&block) if block #super(&block) super(&block) else super("") end @name=name @body_function=body_function end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/rghost/function.rb', line 12 def name @name end |
Instance Method Details
#ps ⇒ Object
32 33 34 35 36 |
# File 'lib/rghost/function.rb', line 32 def ps @body_function||=super "\n/#{@name}{\n#{@body_function}\n} bind def \n" end |
#use_template(function_name) ⇒ Object
28 29 30 31 |
# File 'lib/rghost/function.rb', line 28 def use_template(function_name) call "_#{function_name}" end |