Class: SqidsWithBlocklistMode
- Defined in:
- lib/encoded_id/encoders/sqids_with_blocklist_mode.rb
Overview
Extension of MySqids (vendored Sqids) that adds blocklist mode support. This subclass overrides blocklist checking to support different modes without modifying the vendored library. In the future, the base class can be changed from MySqids to ::Sqids::Sqids once we use the official gem.
Constant Summary
Constants inherited from MySqids
MySqids::DEFAULT_ALPHABET, MySqids::DEFAULT_BLOCKLIST, MySqids::DEFAULT_MIN_LENGTH, MySqids::MAX_INT
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ SqidsWithBlocklistMode
constructor
A new instance of SqidsWithBlocklistMode.
Methods inherited from MySqids
Constructor Details
#initialize(options = {}) ⇒ SqidsWithBlocklistMode
Returns a new instance of SqidsWithBlocklistMode.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/encoded_id/encoders/sqids_with_blocklist_mode.rb', line 15 def initialize( = {}) @blocklist_mode = [:blocklist_mode] || :length_threshold @blocklist_max_length = [:blocklist_max_length] || 32 # Remove our custom options before passing to parent = .dup .delete(:blocklist_mode) .delete(:blocklist_max_length) super() end |