Class: Markdo::QueryCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/markdo/commands/query_command.rb

Instance Method Summary collapse

Methods inherited from Command

#initialize

Constructor Details

This class inherits a constructor from Markdo::Command

Instance Method Details

#run(string) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/markdo/commands/query_command.rb', line 5

def run(string)
  regexp = Regexp.new(string, Regexp::IGNORECASE)
  tasks = task_collection.with_match(regexp).reject(&:complete?)

  tasks.each do |task|
    @stdout.puts(task.line)
  end
end