Class: MySQLBinUUID::Type::Data

Inherits:
ActiveModel::Type::Binary::Data
  • Object
show all
Defined in:
lib/mysql-binuuid/type.rb

Overview

We’re inheriting from the Binary type since ActiveRecord in that case will get the hex value. All we need to do to provide the hex value of the UUID, is to return the UUID without dashes. And because this inherits from Binary::Data, ActiveRecord will quote the hex value as required by the database to store it.

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Data



49
50
51
# File 'lib/mysql-binuuid/type.rb', line 49

def initialize(value)
  @value = value
end

Instance Method Details

#hexObject



53
54
55
# File 'lib/mysql-binuuid/type.rb', line 53

def hex
  @value
end