Class: CoolId::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/cool_id.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prefix:, model_class:, length: nil, alphabet: nil, max_retries: nil, id_field: nil) ⇒ Config

Returns a new instance of Config.



98
99
100
101
102
103
104
105
# File 'lib/cool_id.rb', line 98

def initialize(prefix:, model_class:, length: nil, alphabet: nil, max_retries: nil, id_field: nil)
  @length = length
  @prefix = validate_prefix(prefix)
  @alphabet = validate_alphabet(alphabet)
  @max_retries = max_retries
  @model_class = model_class
  @id_field = id_field
end

Instance Attribute Details

#alphabetObject (readonly)

Returns the value of attribute alphabet.



96
97
98
# File 'lib/cool_id.rb', line 96

def alphabet
  @alphabet
end

#id_fieldObject (readonly)

Returns the value of attribute id_field.



96
97
98
# File 'lib/cool_id.rb', line 96

def id_field
  @id_field
end

#lengthObject (readonly)

Returns the value of attribute length.



96
97
98
# File 'lib/cool_id.rb', line 96

def length
  @length
end

#max_retriesObject (readonly)

Returns the value of attribute max_retries.



96
97
98
# File 'lib/cool_id.rb', line 96

def max_retries
  @max_retries
end

#model_classObject (readonly)

Returns the value of attribute model_class.



96
97
98
# File 'lib/cool_id.rb', line 96

def model_class
  @model_class
end

#prefixObject (readonly)

Returns the value of attribute prefix.



96
97
98
# File 'lib/cool_id.rb', line 96

def prefix
  @prefix
end