Class: VimColorScheme::CommentNode
- Inherits:
-
Object
- Object
- VimColorScheme::CommentNode
- Defined in:
- lib/vimcolorscheme/comment_node.rb
Instance Method Summary collapse
-
#initialize(comment) ⇒ CommentNode
constructor
Initializes the comment node with a comment string.
-
#to_s ⇒ Object
Renders the comment node by splitting the string at newlines and then appending the “ comment character at the start of each line and joining the result with newlines.
Constructor Details
#initialize(comment) ⇒ CommentNode
Initializes the comment node with a comment string.
4 5 6 |
# File 'lib/vimcolorscheme/comment_node.rb', line 4 def initialize comment @comment = comment end |
Instance Method Details
#to_s ⇒ Object
Renders the comment node by splitting the string at newlines and then appending the “ comment character at the start of each line and joining the result with newlines.
11 12 13 |
# File 'lib/vimcolorscheme/comment_node.rb', line 11 def to_s @comment.split(/\n/).map { |str| str = '" ' + str }.join("\n") + "\n" end |