Class: TPPlus::Nodes::CommentNode

Inherits:
BaseNode
  • Object
show all
Defined in:
lib/tp_plus/nodes/comment_node.rb

Instance Method Summary collapse

Methods inherited from BaseNode

#can_be_inlined?

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