Class: TPPlus::Nodes::CommentNode
- Defined in:
- lib/tp_plus/nodes/comment_node.rb
Instance Method Summary collapse
- #eval(context) ⇒ Object
-
#initialize(text) ⇒ CommentNode
constructor
A new instance of CommentNode.
Methods inherited from BaseNode
Constructor Details
#initialize(text) ⇒ CommentNode
Returns a new instance of CommentNode.
4 5 6 |
# File 'lib/tp_plus/nodes/comment_node.rb', line 4 def initialize(text) @text = text[1,text.length] end |
Instance Method Details
#eval(context) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/tp_plus/nodes/comment_node.rb', line 8 def eval(context) s = "" width = 29 @text.scan(/\S.{0,#{width}}\S(?=\s|$)|\S+/).each do |piece| s += "! #{piece} ;\n" end s[0,s.length-3] end |