Class: Forematter::Commands::Remove
- Inherits:
-
Forematter::CommandRunner
- Object
- Cri::CommandRunner
- Forematter::CommandRunner
- Forematter::Commands::Remove
- Defined in:
- lib/forematter/commands/remove.rb
Instance Method Summary collapse
Methods inherited from Forematter::CommandRunner
Instance Method Details
#run ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/forematter/commands/remove.rb', line 15 def run files_with(field).each do |file| old = file[field].to_ruby log_skip(file, "#{field} is not an array") && next unless old.is_a?(Array) # Continue unless old contains elements of values next if (old & values).empty? values.each { |v| file[field].delete(v) } file.write end end |