Sha256: cb56f83ba414cfa1ad1750df8408008515ca5b84a56074fc4cd8f22daacc61bd

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 Bytes

Contents

module Trax
  module Model
    class Config < ::Hashie::Dash
      ERROR_MESSAGES = {
        :invalid_uuid_prefix => [
          "UUID prefix must be 2 characters long",
          "and can only include a-f0-9",
          "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 !~ /[a-f0-9]{2}/
          raise ERROR_MESSAGES[:invalid_uuid_prefix]
        end

        self[:uuid_prefix] = prefix
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
trax_model-0.0.1 lib/trax/model/config.rb