Class: MarkovUuid::Storage

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input_file, cache_file) ⇒ Storage

Returns a new instance of Storage.



18
19
20
21
22
# File 'lib/markov_uuid/storage.rb', line 18

def initialize input_file, cache_file
  @input_file, @cache_file =  input_file, cache_file

  preload_data
end

Instance Attribute Details

#cache_fileObject

Returns the value of attribute cache_file.



5
6
7
# File 'lib/markov_uuid/storage.rb', line 5

def cache_file
  @cache_file
end

#data=(value) ⇒ Object

Sets the attribute data

Parameters:

  • value

    the value to set the attribute data to.



5
6
7
# File 'lib/markov_uuid/storage.rb', line 5

def data=(value)
  @data = value
end

#input_fileObject

Returns the value of attribute input_file.



5
6
7
# File 'lib/markov_uuid/storage.rb', line 5

def input_file
  @input_file
end

Instance Method Details

#chainObject



14
15
16
# File 'lib/markov_uuid/storage.rb', line 14

def chain
  @chain ||= MarkovUuid::Chain.new data
end

#file_klassObject

for testing



25
26
27
# File 'lib/markov_uuid/storage.rb', line 25

def file_klass
  File
end

#uuidObject

note these are not by any means guaranteed to be unique dependent on uuid length and corpus size maybe maintain uniqueness elsewhere by regenerating unless unique



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

def uuid
  chain.uuid
end