lib/active_uxid/base.rb in active_uxid-1.0.10 vs lib/active_uxid/base.rb in active_uxid-1.0.11
- old
+ new
@@ -1,11 +1,19 @@
# frozen_string_literal: true
module ActiveUxid
class Base
- ENCODING_CHARS ||= ActiveUxid.configuration.encoding_chars
- ENCODING_LENGTH = ActiveUxid.configuration.encoding_length
- ENCODING_SALT ||= ActiveUxid.configuration.encoding_salt
+ def initialize
+ @config = ActiveUxid.configuration
+ end
+
+ %w[encoding_chars encoding_length encoding_salt].each do |setting|
+ define_method(setting) { @config.send(setting) }
+ end
+
+ def encoding_base
+ encoding_chars.length
+ end
end
end