Class: FactoryFaster::DataStore

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

Overview

Each row looks like this: filename|md5 hash|lines to skip test/unit/foo_test.rb|abcdefabcde|5,12,19,20

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filename) ⇒ DataStore

Returns a new instance of DataStore.


12
13
14
15
# File 'lib/factory_faster/data_store.rb', line 12

def initialize(filename)
  @store_file = filename
  load
end

Instance Attribute Details

#recordsObject (readonly)

Returns the value of attribute records


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

def records
  @records
end

#store_fileObject (readonly)

Returns the value of attribute store_file


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

def store_file
  @store_file
end

Instance Method Details

#set(filename, skips) ⇒ Object


17
18
19
20
# File 'lib/factory_faster/data_store.rb', line 17

def set(filename, skips)
  @records[filename] = [signature_for(filename),skips]
  store
end

#skips_for(filename) ⇒ Object


22
23
24
# File 'lib/factory_faster/data_store.rb', line 22

def skips_for(filename)
  (!@records[filename].nil? && !@records[filename][1].nil?) ? @records[filename][1] : []
end

#unchanged?(filename) ⇒ Boolean

Returns:

  • (Boolean)

26
27
28
# File 'lib/factory_faster/data_store.rb', line 26

def unchanged?(filename)
  !@records[filename].nil? && @records[filename][0] == signature_for(filename)
end