class Innodb::DataType::BitType
MySQL’s Bit-Value Type (BIT).
Attributes
name[R]
width[R]
Public Class Methods
new(base_type, modifiers, properties)
click to toggle source
# File lib/innodb/data_type.rb, line 14 def initialize(base_type, modifiers, properties) nbits = modifiers.fetch(0, 1) raise "Unsupported width for BIT type." unless nbits >= 0 && nbits <= 64 @width = (nbits + 7) / 8 @name = Innodb::DataType.make_name(base_type, modifiers, properties) end
Public Instance Methods
value(data)
click to toggle source
# File lib/innodb/data_type.rb, line 22 def value(data) "0b%b" % BinData.const_get("Uint%dbe" % (@width * 8)).read(data) end