Class: EncodedId::Rails::Configuration
- Inherits:
-
Object
- Object
- EncodedId::Rails::Configuration
- Defined in:
- lib/encoded_id/rails/configuration.rb
Overview
Configuration class for initializer
Constant Summary collapse
- VALID_ENCODERS =
[:hashids, :sqids].freeze
- DEFAULT_ENCODER =
:sqids
Instance Attribute Summary collapse
-
#alphabet ⇒ Object
: ::EncodedId::Alphabet.
-
#annotated_id_separator ⇒ Object
: String.
-
#annotation_method_name ⇒ Object
: Symbol.
-
#blocklist ⇒ Object
: ::EncodedId::Blocklist.
-
#blocklist_max_length ⇒ Object
: Integer.
-
#blocklist_mode ⇒ Object
: Symbol.
-
#character_group_size ⇒ Object
: Integer.
-
#downcase_on_decode ⇒ Object
: bool.
-
#encoder ⇒ Object
: Symbol.
-
#group_separator ⇒ Object
: String.
-
#hex_digit_encoding_group_size ⇒ Object
: Integer.
-
#id_length ⇒ Object
: Integer.
-
#max_inputs_per_id ⇒ Object
: Integer.
-
#max_length ⇒ Object
: Integer?.
-
#model_to_param_returns_encoded_id ⇒ Object
: bool.
-
#salt ⇒ Object
Returns the value of attribute salt.
-
#slug_value_method_name ⇒ Object
: Symbol.
-
#slugged_id_separator ⇒ Object
: String.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/encoded_id/rails/configuration.rb', line 51 def initialize @character_group_size = 4 @group_separator = "-" @alphabet = ::EncodedId::Alphabet.modified_crockford @id_length = 8 @max_length = 128 @max_inputs_per_id = 32 @hex_digit_encoding_group_size = 4 @slug_value_method_name = :name_for_encoded_id_slug @slugged_id_separator = "--" @annotation_method_name = :annotation_for_encoded_id @annotated_id_separator = "_" @model_to_param_returns_encoded_id = false @encoder = DEFAULT_ENCODER @blocklist = ::EncodedId::Blocklist.empty @blocklist_mode = :length_threshold @blocklist_max_length = 32 @downcase_on_decode = false @salt = nil end |
Instance Attribute Details
#alphabet ⇒ Object
: ::EncodedId::Alphabet
33 34 35 |
# File 'lib/encoded_id/rails/configuration.rb', line 33 def alphabet @alphabet end |
#annotated_id_separator ⇒ Object
: String
47 48 49 |
# File 'lib/encoded_id/rails/configuration.rb', line 47 def annotated_id_separator @annotated_id_separator end |
#annotation_method_name ⇒ Object
: Symbol
39 40 41 |
# File 'lib/encoded_id/rails/configuration.rb', line 39 def annotation_method_name @annotation_method_name end |
#blocklist ⇒ Object
: ::EncodedId::Blocklist
41 42 43 |
# File 'lib/encoded_id/rails/configuration.rb', line 41 def blocklist @blocklist end |
#blocklist_max_length ⇒ Object
: Integer
43 44 45 |
# File 'lib/encoded_id/rails/configuration.rb', line 43 def blocklist_max_length @blocklist_max_length end |
#blocklist_mode ⇒ Object
: Symbol
42 43 44 |
# File 'lib/encoded_id/rails/configuration.rb', line 42 def blocklist_mode @blocklist_mode end |
#character_group_size ⇒ Object
: Integer
32 33 34 |
# File 'lib/encoded_id/rails/configuration.rb', line 32 def character_group_size @character_group_size end |
#downcase_on_decode ⇒ Object
: bool
44 45 46 |
# File 'lib/encoded_id/rails/configuration.rb', line 44 def downcase_on_decode @downcase_on_decode end |
#encoder ⇒ Object
: Symbol
48 49 50 |
# File 'lib/encoded_id/rails/configuration.rb', line 48 def encoder @encoder end |
#group_separator ⇒ Object
: String
45 46 47 |
# File 'lib/encoded_id/rails/configuration.rb', line 45 def group_separator @group_separator end |
#hex_digit_encoding_group_size ⇒ Object
: Integer
37 38 39 |
# File 'lib/encoded_id/rails/configuration.rb', line 37 def hex_digit_encoding_group_size @hex_digit_encoding_group_size end |
#id_length ⇒ Object
: Integer
34 35 36 |
# File 'lib/encoded_id/rails/configuration.rb', line 34 def id_length @id_length end |
#max_inputs_per_id ⇒ Object
: Integer
36 37 38 |
# File 'lib/encoded_id/rails/configuration.rb', line 36 def max_inputs_per_id @max_inputs_per_id end |
#max_length ⇒ Object
: Integer?
35 36 37 |
# File 'lib/encoded_id/rails/configuration.rb', line 35 def max_length @max_length end |
#model_to_param_returns_encoded_id ⇒ Object
: bool
40 41 42 |
# File 'lib/encoded_id/rails/configuration.rb', line 40 def model_to_param_returns_encoded_id @model_to_param_returns_encoded_id end |
#salt ⇒ Object
Returns the value of attribute salt.
31 32 33 |
# File 'lib/encoded_id/rails/configuration.rb', line 31 def salt @salt end |
#slug_value_method_name ⇒ Object
: Symbol
38 39 40 |
# File 'lib/encoded_id/rails/configuration.rb', line 38 def slug_value_method_name @slug_value_method_name end |
#slugged_id_separator ⇒ Object
: String
46 47 48 |
# File 'lib/encoded_id/rails/configuration.rb', line 46 def slugged_id_separator @slugged_id_separator end |