Class: Markdo::QueryCommand
- Defined in:
- lib/markdo/query_command.rb
Direct Known Subclasses
Instance Method Summary collapse
Methods inherited from Command
Constructor Details
This class inherits a constructor from Markdo::Command
Instance Method Details
#run(string) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/markdo/query_command.rb', line 5 def run(string) regexp = Regexp.new(string, Regexp::IGNORECASE) matches = Dir. glob(markdown_glob). map { |path| File.readlines(path, encoding: 'UTF-8') }. flatten. grep(regexp) @stdout.puts(matches) end |