Class: KeepUp::FileFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/keep_up/file_filter.rb

Overview

Base class for file filters

Direct Known Subclasses

GemfileFilter, GemspecFilter

Class Method Summary collapse

Class Method Details

.apply_to_file(file, dependency) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/keep_up/file_filter.rb', line 6

def self.apply_to_file(file, dependency)
  contents = File.read(file)
  updated_contents = apply(contents, dependency)
  if contents == updated_contents
    false
  else
    File.write file, updated_contents
    true
  end
end