Class: HashIdentable::Configuration

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

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



13
14
15
# File 'lib/hash_identable/configuration.rb', line 13

def initialize
  @hash_length = 36
end

Instance Method Details

#add_object(klass, id) ⇒ Object



17
18
19
20
21
22
# File 'lib/hash_identable/configuration.rb', line 17

def add_object klass, id
  klass.class_eval do
    include(HashIdentable)
  end
  lookup_table.store(id, klass.to_s)
end

#hash_lengthObject



29
30
31
32
# File 'lib/hash_identable/configuration.rb', line 29

def hash_length
  return @hash_length unless @hash_length.nil?
  raise "You must set the hash_length for the system"
end

#saltObject



24
25
26
27
# File 'lib/hash_identable/configuration.rb', line 24

def salt
  return @salt unless @salt.nil?
  raise "You must set the salt for the system"
end

#set_length(length_of_string) ⇒ Object



38
39
40
# File 'lib/hash_identable/configuration.rb', line 38

def set_length(length_of_string)
  @hash_length = length_of_string
end

#set_salt(new_salt) ⇒ Object



34
35
36
# File 'lib/hash_identable/configuration.rb', line 34

def set_salt(new_salt)
  @salt = new_salt
end