jqr-typed_serialize 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,2 +1,5 @@
1
+ v0.0.3. Simplifying by requiring the class_name parameter to typed_serialize.
2
+
1
3
  v0.0.2. Fixing a bug where typed_serialize would always return a new Hash.
4
+
2
5
  v0.0.1. Initial release.
data/Manifest CHANGED
@@ -6,4 +6,5 @@ LICENSE
6
6
  Manifest
7
7
  Rakefile
8
8
  README.rdoc
9
+ typed_serialize.gemspec
9
10
  uninstall.rb
@@ -1,15 +1,13 @@
1
1
  class ActiveRecord::Base
2
- def self.typed_serialize(attr_name, class_name = Object)
2
+ def self.typed_serialize(attr_name, class_name)
3
3
  serialize(attr_name, class_name)
4
4
 
5
- if class_name != Object
6
- define_method(attr_name) do
7
- expected_class = self.class.serialized_attributes[attr_name.to_s]
8
- if (value = super).is_a?(expected_class)
9
- value
10
- else
11
- self.send("#{attr_name}=", expected_class.new)
12
- end
5
+ define_method(attr_name) do
6
+ expected_class = self.class.serialized_attributes[attr_name.to_s]
7
+ if (value = super).is_a?(expected_class)
8
+ value
9
+ else
10
+ self.send("#{attr_name}=", expected_class.new)
13
11
  end
14
12
  end
15
13
  end
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{typed_serialize}
5
- s.version = "0.0.2"
5
+ s.version = "0.0.3"
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{2009-01-16}
9
+ s.date = %q{2009-01-26}
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"]
13
- s.files = ["CHANGELOG", "init.rb", "install.rb", "lib/typed_serialize.rb", "LICENSE", "Manifest", "Rakefile", "README.rdoc", "uninstall.rb", "typed_serialize.gemspec"]
13
+ s.files = ["CHANGELOG", "init.rb", "install.rb", "lib/typed_serialize.rb", "LICENSE", "Manifest", "Rakefile", "README.rdoc", "typed_serialize.gemspec", "uninstall.rb"]
14
14
  s.has_rdoc = true
15
15
  s.homepage = %q{}
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Typed_serialize", "--main", "README.rdoc"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jqr-typed_serialize
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elijah Miller
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-16 00:00:00 -08:00
12
+ date: 2009-01-26 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -41,8 +41,8 @@ files:
41
41
  - Manifest
42
42
  - Rakefile
43
43
  - README.rdoc
44
- - uninstall.rb
45
44
  - typed_serialize.gemspec
45
+ - uninstall.rb
46
46
  has_rdoc: true
47
47
  homepage: ""
48
48
  post_install_message: