Sha256: a731f311b2aff7ffc3e6e0e8f9033c1ca6ea3a00bec72ebee2d3cdb9411d61b8

Contents?: true

Size: 383 Bytes

Versions: 2

Compression:

Stored size: 383 Bytes

Contents

module JDBC
  class UUID
    def initialize(value)
      @value = value.to_s
    end

    def to_java
      java.util.UUID.from_string(value)
    end

    def valid?
      !UUID_REGEX.match(value).nil?
    end

    private

    attr_reader :value

    UUID_REGEX = /^[0-9A-F]{8}-[0-9A-F]{4}-[4][0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i
    private_constant :UUID_REGEX
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jdbc-0.1.1-java lib/jdbc/uuid.rb
jdbc-0.1.0-jruby lib/jdbc/uuid.rb