Sha256: 9396db1236541b41fa8d4cb552c2e6be29ba522eb9c0a6878d52bd1bba536e93
Contents?: true
Size: 425 Bytes
Versions: 1
Compression:
Stored size: 425 Bytes
Contents
#encoding: utf-8 require 'markdo/command' module Markdo class QueryCommand < Command def run(string) regexp = Regexp.new(string, Regexp::IGNORECASE) matches = Dir. glob(markdown_glob). map { |path| File.readlines(path) }. flatten. grep(regexp) @stdout.puts(matches) end protected def markdown_glob "#{@env['MARKDO_ROOT']}/*.md" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
markdo-0.1.1 | lib/markdo/query_command.rb |