class Innodb::DataType::YearType

Attributes

name[R]
width[R]

Public Class Methods

new(base_type, modifiers, properties) click to toggle source
# File lib/innodb/data_type.rb, line 256
def initialize(base_type, modifiers, properties)
  @width = 1
  @display_width = modifiers.fetch(0, 4)
  @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 262
def value(data)
  year = BinData::Uint8.read(data)
  return (year % 100).to_s if @display_width != 4
  return (year + 1900).to_s if year != 0

  "0000"
end