Class: Tarantool::Client::UUID

Inherits:
Data
  • Object
show all
Defined in:
tarantool-client/lib/tarantool/client/uuid.rb,
tarantool-client/lib/tarantool/client/uuid.rb

Overview

A Tarantool uuid value; only instances of this type are sent as MP_EXT uuid, never plain strings.

Constant Summary collapse

FORMAT =
/\A\h{8}-\h{4}-\h{4}-\h{4}-\h{12}\z/

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value:) ⇒ UUID

Returns a new instance of UUID.

Raises:

  • (ArgumentError)


7
8
9
10
11
# File 'tarantool-client/lib/tarantool/client/uuid.rb', line 7

def initialize(value:)
  raise ArgumentError, "invalid UUID: #{value.inspect}" unless value.is_a?(String) && value.match?(UUID::FORMAT)

  super(value: value.downcase.freeze)
end

Instance Attribute Details

#value ⇒ Object (readonly)

Returns the value of attribute value

Returns:

  • (Object) —

    the current value of value



6
7
8
# File 'tarantool-client/lib/tarantool/client/uuid.rb', line 6

def value
  @value
end

Instance Method Details

#to_s ⇒ Object



13
14
15
# File 'tarantool-client/lib/tarantool/client/uuid.rb', line 13

def to_s
  value
end