cerealize 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +21 -2
- data/{README → README.rdoc} +19 -17
- data/Rakefile +4 -2
- data/TODO +13 -3
- data/bench/simple.png +0 -0
- data/bench/simple.rb +99 -0
- data/cerealize.gemspec +53 -0
- data/lib/cerealize.rb +94 -54
- data/lib/cerealize/version.rb +1 -1
- data/slide/2010-04-24-cerealize.key/Contents/PkgInfo +1 -0
- data/slide/2010-04-24-cerealize.key/QuickLook/Thumbnail.jpg +0 -0
- data/slide/2010-04-24-cerealize.key/background.png +0 -0
- data/slide/2010-04-24-cerealize.key/cardinal-blue-black_200.png +0 -0
- data/slide/2010-04-24-cerealize.key/cereal-box.png +0 -0
- data/slide/2010-04-24-cerealize.key/color-profile +0 -0
- data/slide/2010-04-24-cerealize.key/index.apxl.gz +0 -0
- data/slide/2010-04-24-cerealize.key/simple.png +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-11.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-16.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-19.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-2.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-22.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-27.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-29.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-30.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-32.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-34.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-38.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-40.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-46.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-50.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-51.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-52.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-54.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0-7.tiff +0 -0
- data/slide/2010-04-24-cerealize.key/thumbs/st0.tiff +0 -0
- data/slide/2010-04-24-cerealize.pdf +0 -0
- data/slide/cereal-box.ai +1619 -8
- data/slide/cereal-box.jpg +0 -0
- data/slide/cereal-box.png +0 -0
- data/test/helper.rb +3 -1
- data/test/helper_active_record.rb +16 -1
- data/test/test_basic.rb +35 -0
- metadata +104 -12
Binary file
|
Binary file
|
data/test/helper.rb
CHANGED
@@ -24,7 +24,7 @@ class Cat < ActiveRecord::Base
|
|
24
24
|
include Cerealize
|
25
25
|
cerealize :name, String, :encoding => :yaml
|
26
26
|
cerealize :tail, Array, :encoding => :marshal, :force_encoding => true
|
27
|
-
cerealize :food, Hash, :encoding => :marshal
|
27
|
+
cerealize :food, Hash, :encoding => :marshal, :force_encoding => false
|
28
28
|
end
|
29
29
|
|
30
30
|
ActiveRecord::Base.connection.create_table :cats, :force => true do |t|
|
@@ -32,3 +32,18 @@ ActiveRecord::Base.connection.create_table :cats, :force => true do |t|
|
|
32
32
|
t.text :tail
|
33
33
|
t.text :food
|
34
34
|
end
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
class Dog < ActiveRecord::Base
|
39
|
+
include Cerealize
|
40
|
+
|
41
|
+
cerealize :mood, String
|
42
|
+
def mood
|
43
|
+
"mood: #{super}"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
ActiveRecord::Base.connection.create_table :dogs, :force => true do |t|
|
48
|
+
t.text :mood
|
49
|
+
end
|
data/test/test_basic.rb
CHANGED
@@ -17,6 +17,24 @@ class BasicTest < Test::Unit::TestCase
|
|
17
17
|
def teardown
|
18
18
|
end
|
19
19
|
|
20
|
+
def test_no_conflict
|
21
|
+
assert ! Cat.respond_to?(:captain)
|
22
|
+
assert !Boat.respond_to?(:food)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_cerealize_module
|
26
|
+
assert Cat < Cat::CerealizeMethods
|
27
|
+
assert Boat < Boat::CerealizeMethods
|
28
|
+
|
29
|
+
assert !( Cat < Boat::CerealizeMethods)
|
30
|
+
assert !(Boat < Cat::CerealizeMethods)
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_super_calling
|
34
|
+
assert_equal 'mood: ', Dog.new.mood
|
35
|
+
assert_equal 'mood: cheerful', Dog.new(:mood => 'cheerful').mood
|
36
|
+
end
|
37
|
+
|
20
38
|
def test_encoding_yaml
|
21
39
|
set_encoding(:yaml)
|
22
40
|
Boat.create :name => 'yamato', :captain => Person.new('kosaku')
|
@@ -31,4 +49,21 @@ class BasicTest < Test::Unit::TestCase
|
|
31
49
|
assert s[0..1] = 'BA'
|
32
50
|
end
|
33
51
|
|
52
|
+
def test_cerealize_option
|
53
|
+
assert_equal({:name => {:class => String,
|
54
|
+
:encoding => :yaml,
|
55
|
+
:codec => Cerealize::Codec::Yaml},
|
56
|
+
|
57
|
+
:tail => {:class => Array,
|
58
|
+
:encoding => :marshal,
|
59
|
+
:codec => Cerealize::Codec::Marshal,
|
60
|
+
:force_encoding => true},
|
61
|
+
|
62
|
+
:food => {:class => Hash,
|
63
|
+
:encoding => :marshal,
|
64
|
+
:codec => Cerealize::Codec::Marshal,
|
65
|
+
:force_encoding => false}},
|
66
|
+
Cat.cerealize_option)
|
67
|
+
end
|
68
|
+
|
34
69
|
end
|
metadata
CHANGED
@@ -1,29 +1,34 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cerealize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 61
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 8
|
8
|
-
-
|
9
|
-
version: 0.8.
|
9
|
+
- 1
|
10
|
+
version: 0.8.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Cardinal Blue
|
14
|
+
- "Lin Jen-Shin (aka godfat \xE7\x9C\x9F\xE5\xB8\xB8)"
|
15
|
+
- Jaime Cham
|
13
16
|
autorequire:
|
14
17
|
bindir: bin
|
15
18
|
cert_chain: []
|
16
19
|
|
17
|
-
date: 2010-
|
20
|
+
date: 2010-07-16 00:00:00 +08:00
|
18
21
|
default_executable:
|
19
22
|
dependencies:
|
20
23
|
- !ruby/object:Gem::Dependency
|
21
24
|
name: activerecord
|
22
25
|
prerelease: false
|
23
26
|
requirement: &id001 !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
24
28
|
requirements:
|
25
29
|
- - ">="
|
26
30
|
- !ruby/object:Gem::Version
|
31
|
+
hash: 9
|
27
32
|
segments:
|
28
33
|
- 2
|
29
34
|
- 3
|
@@ -32,20 +37,38 @@ dependencies:
|
|
32
37
|
type: :runtime
|
33
38
|
version_requirements: *id001
|
34
39
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
40
|
+
name: sqlite3-ruby
|
36
41
|
prerelease: false
|
37
42
|
requirement: &id002 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
38
44
|
requirements:
|
39
45
|
- - ">="
|
40
46
|
- !ruby/object:Gem::Version
|
47
|
+
hash: 25
|
41
48
|
segments:
|
49
|
+
- 1
|
42
50
|
- 3
|
43
|
-
- 4
|
44
51
|
- 1
|
45
|
-
version: 3.
|
52
|
+
version: 1.3.1
|
46
53
|
type: :development
|
47
54
|
version_requirements: *id002
|
48
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bones
|
57
|
+
prerelease: false
|
58
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 25
|
64
|
+
segments:
|
65
|
+
- 3
|
66
|
+
- 4
|
67
|
+
- 7
|
68
|
+
version: 3.4.7
|
69
|
+
type: :development
|
70
|
+
version_requirements: *id003
|
71
|
+
description: " Serialize out of the Cerealize Box\n - a drop-in replacement for ActiveRecord's serialize\n\n It can auto transcode old encoding (yaml if you're using AR's serialize),\n to new encoding (marshal, json, you name it) without any migration.\n\n Current supported encoding:\n 1. YAML\n 2. Marshal\n 3. JSON (planned)\n\n Current supported ORM:\n 1. ActiveRecord (tested with 2.3.5)\n 2. DataMapper (planned)"
|
49
72
|
email: dev (XD) cardinalblue.com
|
50
73
|
executables: []
|
51
74
|
|
@@ -54,20 +77,85 @@ extensions: []
|
|
54
77
|
extra_rdoc_files:
|
55
78
|
- CHANGES
|
56
79
|
- LICENSE
|
57
|
-
- README
|
58
|
-
- Rakefile
|
59
80
|
- TODO
|
81
|
+
- bench/simple.png
|
82
|
+
- cerealize.gemspec
|
83
|
+
- slide/2010-04-24-cerealize.key/Contents/PkgInfo
|
84
|
+
- slide/2010-04-24-cerealize.key/QuickLook/Thumbnail.jpg
|
85
|
+
- slide/2010-04-24-cerealize.key/background.png
|
86
|
+
- slide/2010-04-24-cerealize.key/cardinal-blue-black_200.png
|
87
|
+
- slide/2010-04-24-cerealize.key/cereal-box.png
|
88
|
+
- slide/2010-04-24-cerealize.key/color-profile
|
89
|
+
- slide/2010-04-24-cerealize.key/index.apxl.gz
|
90
|
+
- slide/2010-04-24-cerealize.key/simple.png
|
91
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-11.tiff
|
92
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-16.tiff
|
93
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-19.tiff
|
94
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-2.tiff
|
95
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-22.tiff
|
96
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-27.tiff
|
97
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-29.tiff
|
98
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-30.tiff
|
99
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-32.tiff
|
100
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-34.tiff
|
101
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-38.tiff
|
102
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-40.tiff
|
103
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-46.tiff
|
104
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-50.tiff
|
105
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-51.tiff
|
106
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-52.tiff
|
107
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-54.tiff
|
108
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-7.tiff
|
109
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0.tiff
|
110
|
+
- slide/2010-04-24-cerealize.pdf
|
111
|
+
- slide/cereal-box.ai
|
112
|
+
- slide/cereal-box.jpg
|
113
|
+
- slide/cereal-box.png
|
60
114
|
files:
|
61
115
|
- CHANGES
|
62
116
|
- LICENSE
|
63
|
-
- README
|
117
|
+
- README.rdoc
|
64
118
|
- Rakefile
|
65
119
|
- TODO
|
120
|
+
- bench/simple.png
|
121
|
+
- bench/simple.rb
|
122
|
+
- cerealize.gemspec
|
66
123
|
- init.rb
|
67
124
|
- lib/cerealize.rb
|
68
125
|
- lib/cerealize/codec/marshal.rb
|
69
126
|
- lib/cerealize/codec/yaml.rb
|
70
127
|
- lib/cerealize/version.rb
|
128
|
+
- slide/2010-04-24-cerealize.key/Contents/PkgInfo
|
129
|
+
- slide/2010-04-24-cerealize.key/QuickLook/Thumbnail.jpg
|
130
|
+
- slide/2010-04-24-cerealize.key/background.png
|
131
|
+
- slide/2010-04-24-cerealize.key/cardinal-blue-black_200.png
|
132
|
+
- slide/2010-04-24-cerealize.key/cereal-box.png
|
133
|
+
- slide/2010-04-24-cerealize.key/color-profile
|
134
|
+
- slide/2010-04-24-cerealize.key/index.apxl.gz
|
135
|
+
- slide/2010-04-24-cerealize.key/simple.png
|
136
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-11.tiff
|
137
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-16.tiff
|
138
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-19.tiff
|
139
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-2.tiff
|
140
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-22.tiff
|
141
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-27.tiff
|
142
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-29.tiff
|
143
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-30.tiff
|
144
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-32.tiff
|
145
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-34.tiff
|
146
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-38.tiff
|
147
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-40.tiff
|
148
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-46.tiff
|
149
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-50.tiff
|
150
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-51.tiff
|
151
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-52.tiff
|
152
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-54.tiff
|
153
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0-7.tiff
|
154
|
+
- slide/2010-04-24-cerealize.key/thumbs/st0.tiff
|
155
|
+
- slide/2010-04-24-cerealize.pdf
|
156
|
+
- slide/cereal-box.ai
|
157
|
+
- slide/cereal-box.jpg
|
158
|
+
- slide/cereal-box.png
|
71
159
|
- test/helper.rb
|
72
160
|
- test/helper_active_record.rb
|
73
161
|
- test/stub.rb
|
@@ -81,27 +169,31 @@ licenses: []
|
|
81
169
|
post_install_message:
|
82
170
|
rdoc_options:
|
83
171
|
- --main
|
84
|
-
- README
|
172
|
+
- README.rdoc
|
85
173
|
require_paths:
|
86
174
|
- lib
|
87
175
|
required_ruby_version: !ruby/object:Gem::Requirement
|
176
|
+
none: false
|
88
177
|
requirements:
|
89
178
|
- - ">="
|
90
179
|
- !ruby/object:Gem::Version
|
180
|
+
hash: 3
|
91
181
|
segments:
|
92
182
|
- 0
|
93
183
|
version: "0"
|
94
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
none: false
|
95
186
|
requirements:
|
96
187
|
- - ">="
|
97
188
|
- !ruby/object:Gem::Version
|
189
|
+
hash: 3
|
98
190
|
segments:
|
99
191
|
- 0
|
100
192
|
version: "0"
|
101
193
|
requirements: []
|
102
194
|
|
103
195
|
rubyforge_project: cerealize
|
104
|
-
rubygems_version: 1.3.
|
196
|
+
rubygems_version: 1.3.7
|
105
197
|
signing_key:
|
106
198
|
specification_version: 3
|
107
199
|
summary: Serialize out of the Cerealize Box - a drop-in replacement for ActiveRecord's serialize It can auto transcode old encoding (yaml if you're using AR's serialize), to new encoding (marshal, json, you name it) without any migration
|