Sha256: ec464b99a16083245bd015696be7044761e90381e5624165e0a2ab0e2f22af03

Contents?: true

Size: 665 Bytes

Versions: 5

Compression:

Stored size: 665 Bytes

Contents

module Trax
  module Model
    class Config < ::Hashie::Dash
      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

      property :uuid_prefix, :default => nil
      property :uuid_column, :default => :id

      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
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
trax_model-0.0.91 lib/trax/model/config.rb
trax_model-0.0.9 lib/trax/model/config.rb
trax_model-0.0.8 lib/trax/model/config.rb
trax_model-0.0.7 lib/trax/model/config.rb
trax_model-0.0.6 lib/trax/model/config.rb