Class: Cucover::SourceFileCache

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

Instance Method Summary collapse

Constructor Details

#initialize(feature_file) ⇒ SourceFileCache

Returns a new instance of SourceFileCache.



10
11
12
# File 'lib/cucover.rb', line 10

def initialize(feature_file)
  @feature_file = feature_file
end

Instance Method Details

#dirty_filesObject



25
26
27
28
29
# File 'lib/cucover.rb', line 25

def dirty_files
  source_files.select do |source_file|
    File.mtime(Dir.pwd + '/' + source_file.strip) > time
  end
end

#exists?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/cucover.rb', line 21

def exists?
  File.exist?(cache_filename)
end

#save(analyzed_files) ⇒ Object



14
15
16
17
18
19
# File 'lib/cucover.rb', line 14

def save(analyzed_files)
  FileUtils.mkdir_p File.dirname(cache_filename)
  File.open(cache_filename, "w") do |file|
    file.puts analyzed_files
  end
end

#timeObject



31
32
33
# File 'lib/cucover.rb', line 31

def time
  File.mtime(cache_filename)
end