Class: HashIdentable::Configuration
- Inherits:
-
Object
- Object
- HashIdentable::Configuration
- Defined in:
- lib/hash_identable/configuration.rb
Instance Method Summary collapse
- #add_object(klass, id) ⇒ Object
- #hash_length ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #salt ⇒ Object
- #set_length(length_of_string) ⇒ Object
- #set_salt(new_salt) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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_length ⇒ Object
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 |
#salt ⇒ Object
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 |