Class: Forematter::Commands::Search
- Inherits:
-
Forematter::CommandRunner
- Object
- Cri::CommandRunner
- Forematter::CommandRunner
- Forematter::Commands::Search
- Defined in:
- lib/forematter/commands/search.rb
Instance Method Summary collapse
Methods inherited from Forematter::CommandRunner
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/forematter/commands/search.rb', line 18 def run files_with(field).sort_by(&:filename).each do |file| field_val = file[field].to_ruby if field_val.is_a? Array next unless field_val.any? { |v| pattern =~ v } else next unless pattern =~ field_val end write(file.filename, field_val) end end |