Class: SmartTodo::CommentParser
- Inherits:
-
Object
- Object
- SmartTodo::CommentParser
- Defined in:
- lib/smart_todo/comment_parser.rb
Constant Summary collapse
- SUPPORTED_TAGS =
["TODO", "FIXME", "OPTIMIZE"].freeze
- TAG_PATTERN =
/^#\s(#{SUPPORTED_TAGS.join("|")})\(/
Instance Attribute Summary collapse
-
#todos ⇒ Object
readonly
Returns the value of attribute todos.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ CommentParser
constructor
A new instance of CommentParser.
- #parse(source, filepath = "-e") ⇒ Object
- #parse_file(filepath) ⇒ Object
Constructor Details
#initialize ⇒ CommentParser
Returns a new instance of CommentParser.
10 11 12 |
# File 'lib/smart_todo/comment_parser.rb', line 10 def initialize @todos = [] end |
Instance Attribute Details
#todos ⇒ Object (readonly)
Returns the value of attribute todos.
8 9 10 |
# File 'lib/smart_todo/comment_parser.rb', line 8 def todos @todos end |
Class Method Details
.parse(source) ⇒ Object
33 34 35 36 37 |
# File 'lib/smart_todo/comment_parser.rb', line 33 def parse(source) parser = new parser.parse(source) parser.todos end |
Instance Method Details
#parse(source, filepath = "-e") ⇒ Object
15 16 17 |
# File 'lib/smart_todo/comment_parser.rb', line 15 def parse(source, filepath = "-e") parse_comments(Prism.parse_comments(source), filepath) end |
#parse_file(filepath) ⇒ Object
19 20 21 |
# File 'lib/smart_todo/comment_parser.rb', line 19 def parse_file(filepath) parse_comments(Prism.parse_file_comments(filepath), filepath) end |