odba 1.1.8 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # encoding: utf-8
3
- # 18_19_loading_compatibility -- odba -- 09.12.2011 -- mhatakeyama@ywesee.com
4
-
5
- require 'date'
6
- require 'strscan'
7
-
8
- if RUBY_VERSION >= '1.9'
9
- def u str
10
- str
11
- end
12
- class Date
13
- def self._load(str)
14
- scn = StringScanner.new str
15
- a = []
16
- while match = scn.get_byte
17
- case match
18
- when ":"
19
- len = scn.get_byte
20
- name = scn.scan /.{#{Marshal.load("\x04\bi#{len}")}}/
21
- when "i"
22
- int = scn.get_byte
23
- size, = int.unpack('c')
24
- if size > 1 && size < 5
25
- size.times do
26
- int << scn.get_byte
27
- end
28
- end
29
- dump = "\x04\bi" << int
30
- a.push Marshal.load(dump)
31
- end
32
- end
33
- ajd = of = sg = 0
34
- if a.size == 3
35
- num, den, sg = a
36
- if den > 0
37
- ajd = Rational(num,den)
38
- ajd -= 1.to_r/2
39
- end
40
- else
41
- num, den, of, sg = a
42
- if den > 0
43
- ajd = Rational(num,den)
44
- end
45
- end
46
- ajd += 1.to_r/2
47
- jd(ajd)
48
- end
49
- end
50
- class Encoding
51
- class Character
52
- class UTF8 < String
53
- module Methods
54
- end
55
- ## when loading Encoding::Character::UTF8 instances simply return
56
- # an encoded String
57
- def self._load data
58
- str = Marshal.load(data)
59
- str.force_encoding 'UTF-8'
60
- str
61
- end
62
- end
63
- end
64
- end
65
- else
66
- class Date
67
- def marshal_load a
68
- @ajd, @of, @sg, = a
69
- @__ca__ = {}
70
- end
71
- end
72
- class Rational
73
- def marshal_load a
74
- @numerator, @denominator, = a
75
- end
76
- end
77
- end