Class: TPPlus::Nodes::CommentNode
- Inherits:
-
Object
- Object
- TPPlus::Nodes::CommentNode
- Defined in:
- lib/tp_plus/nodes/comment_node.rb
Instance Method Summary collapse
- #can_be_inlined? ⇒ Boolean
- #eval(context) ⇒ Object
-
#initialize(text) ⇒ CommentNode
constructor
A new instance of CommentNode.
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
#can_be_inlined? ⇒ Boolean
8 9 10 |
# File 'lib/tp_plus/nodes/comment_node.rb', line 8 def can_be_inlined? false end |
#eval(context) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/tp_plus/nodes/comment_node.rb', line 12 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 |