module RUUID::Formatter

@private

Constants

HEX_FORMAT

Public Instance Methods

format(data, format = RUUID.default_format) click to toggle source
# File lib/ruuid/formatter.rb, line 8
def format(data, format = RUUID.default_format)
  parts = data.unpack(HEX_FORMAT)

  case format
  when :canonical then parts.join('-')
  when :compact   then parts.join
  else
    raise ArgumentError, "`#{format.inspect}' format not supported. Supported formats are: :canonical and :compact"
  end
end