Class: TodoCreator
- Inherits:
-
Object
- Object
- TodoCreator
- Defined in:
- lib/what_now.rb
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ TodoCreator
constructor
A new instance of TodoCreator.
- #match(line, path, line_number) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ TodoCreator
Returns a new instance of TodoCreator.
7 8 9 10 11 |
# File 'lib/what_now.rb', line 7 def initialize(opts={}) pretty = opts.fetch(:pretty, true) @ignorecase = opts[:ignorecase] @todo_class = pretty ? PrettyTodo : Todo end |
Instance Method Details
#match(line, path, line_number) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/what_now.rb', line 13 def match(line, path, line_number) regex = @ignorecase ? /TODO:?\s*(.+)$/i : /TODO:?\s*(.+)$/ text = regex.match(line) @todo_class.new(text[1], path, line_number) if text rescue ArgumentError nil end |