lib/active_uxid/ulid.rb in active_uxid-1.0.6 vs lib/active_uxid/ulid.rb in active_uxid-1.0.7

- old
+ new

@@ -1,18 +1,21 @@ # frozen_string_literal: true module ActiveUxid class Ulid < ActiveUxid::Base + ENCODING_CHARS ||= ActiveUxid.configuration.encoding_chars + ENCODING_LENGTH ||= ActiveUxid.configuration.encoding_length + def initialize; end def self.encode klass = new klass.uxid_encode end def uxid_encode - (1..ActiveUxid.configuration.encoding_length).reduce('') do |str, num| + (1..ENCODING_LENGTH).reduce('') do |str, num| shift = 128 - 5 * num "#{str}#{ENCODING_CHARS[(uxid_octect >> shift) & 0x1f]}" end end