typed_serialize 0.1.0 → 0.1.1
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/CHANGELOG +3 -1
- data/README.rdoc +5 -1
- data/lib/typed_serialize.rb +3 -3
- data/typed_serialize.gemspec +4 -4
- metadata +15 -5
data/CHANGELOG
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
v0.1.1. Fix implicit argument passing of super
|
|
2
|
+
|
|
1
3
|
v0.1.0. Released to gemcutter.
|
|
2
4
|
|
|
3
5
|
v0.0.3. Simplifying by requiring the class_name parameter to typed_serialize.
|
|
4
6
|
|
|
5
7
|
v0.0.2. Fixing a bug where typed_serialize would always return a new Hash.
|
|
6
8
|
|
|
7
|
-
v0.0.1. Initial release.
|
|
9
|
+
v0.0.1. Initial release.
|
data/README.rdoc
CHANGED
|
@@ -23,10 +23,14 @@ As a Rails plugin:
|
|
|
23
23
|
|
|
24
24
|
Prefer gems? Add this to your environment.rb and run the following command.
|
|
25
25
|
|
|
26
|
-
config.gem '
|
|
26
|
+
config.gem 'typed_serialize'
|
|
27
27
|
|
|
28
28
|
$ rake gems:install
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
== Docs
|
|
32
|
+
|
|
33
|
+
http://rdoc.info/projects/jqr/typed_serialize
|
|
34
|
+
|
|
31
35
|
Homepage:: http://github.com/jqr/typed_serialize
|
|
32
36
|
License:: Copyright (c) 2008 Elijah Miller <mailto:elijah.miller@gmail.com>, released under the MIT license
|
data/lib/typed_serialize.rb
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
class ActiveRecord::Base
|
|
1
|
+
class ActiveRecord::Base
|
|
2
2
|
def self.typed_serialize(attr_name, class_name)
|
|
3
3
|
serialize(attr_name, class_name)
|
|
4
4
|
|
|
5
5
|
define_method(attr_name) do
|
|
6
6
|
expected_class = self.class.serialized_attributes[attr_name.to_s]
|
|
7
|
-
if (value = super).is_a?(expected_class)
|
|
7
|
+
if (value = super()).is_a?(expected_class)
|
|
8
8
|
value
|
|
9
9
|
else
|
|
10
10
|
send("#{attr_name}=", expected_class.new)
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
end
|
|
14
|
-
end
|
|
14
|
+
end
|
data/typed_serialize.gemspec
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |s|
|
|
4
4
|
s.name = %q{typed_serialize}
|
|
5
|
-
s.version = "0.1.
|
|
5
|
+
s.version = "0.1.1"
|
|
6
6
|
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
|
8
8
|
s.authors = ["Elijah Miller"]
|
|
9
|
-
s.date = %q{
|
|
9
|
+
s.date = %q{2010-10-21}
|
|
10
10
|
s.description = %q{Typed serialize makes sure your serialized attribute is always the specified type.}
|
|
11
11
|
s.email = %q{elijah.miller@gmail.com}
|
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "lib/typed_serialize.rb", "LICENSE", "README.rdoc"]
|
|
@@ -15,14 +15,14 @@ Gem::Specification.new do |s|
|
|
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Typed_serialize", "--main", "README.rdoc"]
|
|
16
16
|
s.require_paths = ["lib"]
|
|
17
17
|
s.rubyforge_project = %q{typed_serialize}
|
|
18
|
-
s.rubygems_version = %q{1.3.
|
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
|
19
19
|
s.summary = %q{Typed serialize makes sure your serialized attribute is always the specified type.}
|
|
20
20
|
|
|
21
21
|
if s.respond_to? :specification_version then
|
|
22
22
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
23
23
|
s.specification_version = 3
|
|
24
24
|
|
|
25
|
-
if Gem::Version.new(Gem::
|
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
26
26
|
else
|
|
27
27
|
end
|
|
28
28
|
else
|
metadata
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: typed_serialize
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
|
|
4
|
+
prerelease: false
|
|
5
|
+
segments:
|
|
6
|
+
- 0
|
|
7
|
+
- 1
|
|
8
|
+
- 1
|
|
9
|
+
version: 0.1.1
|
|
5
10
|
platform: ruby
|
|
6
11
|
authors:
|
|
7
12
|
- Elijah Miller
|
|
@@ -9,7 +14,7 @@ autorequire:
|
|
|
9
14
|
bindir: bin
|
|
10
15
|
cert_chain: []
|
|
11
16
|
|
|
12
|
-
date:
|
|
17
|
+
date: 2010-10-21 00:00:00 -04:00
|
|
13
18
|
default_executable:
|
|
14
19
|
dependencies: []
|
|
15
20
|
|
|
@@ -50,21 +55,26 @@ rdoc_options:
|
|
|
50
55
|
require_paths:
|
|
51
56
|
- lib
|
|
52
57
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
58
|
+
none: false
|
|
53
59
|
requirements:
|
|
54
60
|
- - ">="
|
|
55
61
|
- !ruby/object:Gem::Version
|
|
62
|
+
segments:
|
|
63
|
+
- 0
|
|
56
64
|
version: "0"
|
|
57
|
-
version:
|
|
58
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
|
+
none: false
|
|
59
67
|
requirements:
|
|
60
68
|
- - ">="
|
|
61
69
|
- !ruby/object:Gem::Version
|
|
70
|
+
segments:
|
|
71
|
+
- 1
|
|
72
|
+
- 2
|
|
62
73
|
version: "1.2"
|
|
63
|
-
version:
|
|
64
74
|
requirements: []
|
|
65
75
|
|
|
66
76
|
rubyforge_project: typed_serialize
|
|
67
|
-
rubygems_version: 1.3.
|
|
77
|
+
rubygems_version: 1.3.7
|
|
68
78
|
signing_key:
|
|
69
79
|
specification_version: 3
|
|
70
80
|
summary: Typed serialize makes sure your serialized attribute is always the specified type.
|