cerealize 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/README +1 -1
- data/README.rdoc +1 -1
- data/cerealize.gemspec +2 -2
- data/lib/cerealize.rb +2 -4
- data/lib/cerealize/version.rb +1 -1
- data/test/real.rb +5 -1
- data/test/test_basic.rb +11 -0
- metadata +4 -4
data/CHANGES
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
= cerealize changes history
|
2
2
|
|
3
|
+
== cerealize 0.8.3 -- 2010-08-12
|
4
|
+
|
5
|
+
* Use class_inheritable_accessor from active_support on cerealize_option to
|
6
|
+
fix issues from inheritance.
|
7
|
+
|
3
8
|
== cerealize 0.8.2 -- 2010-08-04
|
4
9
|
* Added attr_hash feature, create virtual properties inside a hash.
|
5
10
|
An example:
|
data/README
CHANGED
data/README.rdoc
CHANGED
data/cerealize.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{cerealize}
|
5
|
-
s.version = "0.8.
|
5
|
+
s.version = "0.8.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Cardinal Blue", "Lin Jen-Shin (aka godfat 真常)", "Jaime Cham"]
|
9
|
-
s.date = %q{2010-08-
|
9
|
+
s.date = %q{2010-08-12}
|
10
10
|
s.description = %q{ Serialize out of the Cerealize Box
|
11
11
|
- a drop-in replacement for ActiveRecord's serialize
|
12
12
|
|
data/lib/cerealize.rb
CHANGED
@@ -23,6 +23,8 @@ module Cerealize
|
|
23
23
|
def self.included(base)
|
24
24
|
base.send( :extend, ClassMethods)
|
25
25
|
base.send(:include, InstanceMethods)
|
26
|
+
base.class_inheritable_accessor :cerealize_option
|
27
|
+
base.cerealize_option = {}
|
26
28
|
end
|
27
29
|
|
28
30
|
module_function
|
@@ -75,10 +77,6 @@ module Cerealize
|
|
75
77
|
end
|
76
78
|
|
77
79
|
module ClassMethods
|
78
|
-
def cerealize_option
|
79
|
-
@cerealize_option ||= {}
|
80
|
-
end
|
81
|
-
|
82
80
|
def cerealize_update_codec_cache
|
83
81
|
cerealize_option.each{ |(property, opt)|
|
84
82
|
opt.merge!(:codec => Cerealize.codec_get(opt[:encoding]))
|
data/lib/cerealize/version.rb
CHANGED
data/test/real.rb
CHANGED
@@ -46,8 +46,12 @@ class Dog < ActiveRecord::Base
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
|
+
class BigDog < Dog
|
50
|
+
cerealize :hook, Integer
|
51
|
+
end
|
52
|
+
|
49
53
|
ActiveRecord::Base.connection.create_table :dogs, :force => true do |t|
|
50
|
-
t.text :mood
|
54
|
+
t.text :mood, :hook
|
51
55
|
end
|
52
56
|
|
53
57
|
# ===================================================================
|
data/test/test_basic.rb
CHANGED
@@ -65,4 +65,15 @@ class BasicTest < Test::Unit::TestCase
|
|
65
65
|
Cat.cerealize_option)
|
66
66
|
end
|
67
67
|
|
68
|
+
def test_inheritance
|
69
|
+
mood = {:mood => {:class => String,
|
70
|
+
:encoding => :marshal,
|
71
|
+
:codec => Cerealize::Codec::Marshal}}
|
72
|
+
hook = {:hook => {:class => Integer,
|
73
|
+
:encoding => :marshal,
|
74
|
+
:codec => Cerealize::Codec::Marshal}}
|
75
|
+
assert_equal(mood , Dog.cerealize_option)
|
76
|
+
assert_equal(mood.merge(hook), BigDog.cerealize_option)
|
77
|
+
end
|
78
|
+
|
68
79
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cerealize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 57
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 3
|
10
|
+
version: 0.8.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Cardinal Blue
|
@@ -17,7 +17,7 @@ autorequire:
|
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
19
|
|
20
|
-
date: 2010-08-
|
20
|
+
date: 2010-08-12 00:00:00 +08:00
|
21
21
|
default_executable:
|
22
22
|
dependencies:
|
23
23
|
- !ruby/object:Gem::Dependency
|