class Date

Public Class Methods

_load(str) click to toggle source
# File lib/odba/18_19_loading_compatibility.rb, line 13
def self._load(str)
  scn = StringScanner.new str
  a = []
  while match = scn.get_byte
    case match
    when ":"
      len = scn.get_byte
      name = scn.scan /.{#{Marshal.load("\x04\bi#{len}")}}/
    when "i"
      int = scn.get_byte
      size, = int.unpack('c')
      if size > 1 && size < 5
        size.times do 
          int << scn.get_byte
        end
      end
      dump = "\x04\bi" << int
      a.push Marshal.load(dump)
    end
  end
  ajd = of = sg = 0
  if a.size == 3
    num, den, sg = a
    if den > 0
      ajd = Rational(num,den)
      ajd -= 1.to_r/2
    end
  else
    num, den, of, sg = a
    if den > 0
      ajd = Rational(num,den)
    end
  end
  ajd += 1.to_r/2
  jd(ajd)
end

Public Instance Methods

marshal_load(a) click to toggle source
# File lib/odba/18_19_loading_compatibility.rb, line 67
def marshal_load a
  @ajd, @of, @sg, = a
  @__ca__ = {}
end