Class: VimColorScheme::CommentNode

Inherits:
Object
  • Object
show all
Defined in:
lib/vimcolorscheme/comment_node.rb

Instance Method Summary collapse

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_sObject

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