class SmartTodo::Parser::TodoNode
Represents a SmartTodo
which includes the associated events as well as the assignee.
Constants
- DEFAULT_RUBY_INDENTATION
Attributes
metadata[R]
Public Class Methods
new(todo)
click to toggle source
@param todo [String] the actual Ruby comment
# File lib/smart_todo/parser/todo_node.rb, line 13 def initialize(todo) @metadata = MetadataParser.parse(todo.gsub(/^#/, '')) @comments = [] @start = todo.match(/^#(\s+)/)[1].size end
Public Instance Methods
<<(comment)
click to toggle source
@param comment [String] @return [void]
# File lib/smart_todo/parser/todo_node.rb, line 28 def <<(comment) @comments << comment.gsub(/^#(\s+)/, '') end
comment()
click to toggle source
Return the associated comment for this TODO
@return [String]
# File lib/smart_todo/parser/todo_node.rb, line 22 def comment @comments.join end
indented_comment?(comment)
click to toggle source
Check if the comment
is indented two spaces below the TODO declaration. If yes the comment is considered to be part of the TODO itself. Otherwise it's just a regular comment.
@param comment [String] @return [true, false]
# File lib/smart_todo/parser/todo_node.rb, line 38 def indented_comment?(comment) comment.match(/^#(\s+)/)[1].size - @start == DEFAULT_RUBY_INDENTATION end