Class: Trax::Model::Config

Inherits:
Hashie::Dash
  • Object
show all
Defined in:
lib/trax/model/config.rb

Constant Summary collapse

ERROR_MESSAGES =
{
  :invalid_uuid_prefix => [
    "UUID prefix must be 2 characters long",
    "and be 0-9 or a-f",
    "for hexadecimal id compatibility"
  ].join("\n")
}.freeze

Instance Method Summary collapse

Instance Method Details

#uuid_prefix=(prefix) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/trax/model/config.rb', line 15

def uuid_prefix=(prefix)
  if prefix.length != 2 || prefix.chars.any?{|char| char !~ /[0-9a-f]/ }
    raise ::Trax::Model::Errors::InvalidPrefixForUUID.new(prefix)
  end

  self[:uuid_prefix] = ::Trax::Model::UUIDPrefix.new(prefix)
end