cerealize 0.8.2 → 0.8.3

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.
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
@@ -1,4 +1,4 @@
1
- = cerealize 0.8.2
1
+ = cerealize 0.8.3
2
2
  by Cardinal Blue ( http://cardinalblue.com )
3
3
 
4
4
  == LINKS:
@@ -1,4 +1,4 @@
1
- = cerealize 0.8.2
1
+ = cerealize 0.8.3
2
2
  by Cardinal Blue ( http://cardinalblue.com )
3
3
 
4
4
  == LINKS:
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cerealize}
5
- s.version = "0.8.1"
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-04}
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
 
@@ -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]))
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Cerealize
3
- VERSION = '0.8.2'
3
+ VERSION = '0.8.3'
4
4
  end
@@ -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
  # ===================================================================
@@ -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: 59
4
+ hash: 57
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 8
9
- - 2
10
- version: 0.8.2
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-04 00:00:00 +08:00
20
+ date: 2010-08-12 00:00:00 +08:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency