RBase::Columns::DateColumn

Public Class Methods

new(name, options = {}) click to toggle source
# File lib/rbase/columns.rb, line 187
def initialize(name, options = {})
  super name, options.merge(:size => 8)
end

Public Instance Methods

inspect() click to toggle source
# File lib/rbase/columns.rb, line 200
def inspect
  "#{name}(date)"
end
pack(value) click to toggle source
# File lib/rbase/columns.rb, line 191
def pack(value)
  value ? value.strftime('%Y%m%d'): ' '*8
end
unpack(data) click to toggle source
# File lib/rbase/columns.rb, line 195
def unpack(data)
  return nil if data.rstrip == ''
  Date.new(*data.unpack("a4a2a2").map { |s| s.to_i})
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.