Class: SmartTodo::CommentParser

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_todo/comment_parser.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommentParser

Returns a new instance of CommentParser.



7
8
9
# File 'lib/smart_todo/comment_parser.rb', line 7

def initialize
  @todos = []
end

Instance Attribute Details

#todosObject (readonly)

Returns the value of attribute todos.



5
6
7
# File 'lib/smart_todo/comment_parser.rb', line 5

def todos
  @todos
end

Class Method Details

.parse(source) ⇒ Object



30
31
32
33
34
# File 'lib/smart_todo/comment_parser.rb', line 30

def parse(source)
  parser = new
  parser.parse(source)
  parser.todos
end

Instance Method Details

#parse(source, filepath = "-e") ⇒ Object



12
13
14
# File 'lib/smart_todo/comment_parser.rb', line 12

def parse(source, filepath = "-e")
  parse_comments(Prism.parse_comments(source), filepath)
end

#parse_file(filepath) ⇒ Object



16
17
18
# File 'lib/smart_todo/comment_parser.rb', line 16

def parse_file(filepath)
  parse_comments(Prism.parse_file_comments(filepath), filepath)
end