serializable_attributes 0.9.0 → 1.0.0
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/README.md +5 -1
- data/gemfiles/ar-3.2.gemfile +6 -0
- data/lib/serializable_attributes.rb +12 -3
- data/lib/serializable_attributes/types.rb +3 -0
- data/rails_init.rb +1 -1
- data/serializable_attributes.gemspec +6 -5
- data/test/serialized_attributes_test.rb +8 -1
- metadata +63 -29
data/README.md
CHANGED
@@ -22,7 +22,11 @@ ActiveRecord and ruby.
|
|
22
22
|
|
23
23
|
## Setup
|
24
24
|
|
25
|
-
|
25
|
+
gem install serializable_attributes
|
26
|
+
|
27
|
+
Sorry for the confusion, but someone took the `serialized_attributes`
|
28
|
+
gem name. I wouldn't mind giving it a completely new name before a
|
29
|
+
"1.0" release though.
|
26
30
|
|
27
31
|
## Usage
|
28
32
|
|
@@ -31,8 +31,8 @@
|
|
31
31
|
# end
|
32
32
|
#
|
33
33
|
module SerializableAttributes
|
34
|
-
VERSION = "0.
|
35
|
-
|
34
|
+
VERSION = "1.0.0"
|
35
|
+
|
36
36
|
require File.expand_path('../serializable_attributes/types', __FILE__)
|
37
37
|
require File.expand_path('../serializable_attributes/schema', __FILE__)
|
38
38
|
|
@@ -60,7 +60,16 @@ module SerializableAttributes
|
|
60
60
|
schema
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
# Install the plugin for the given model class.
|
65
|
+
#
|
66
|
+
# active_record - A class to install the plugin. Default: ActiveRecord::Base.
|
67
|
+
#
|
68
|
+
# Returns nothing.
|
69
|
+
def self.setup(active_record = ActiveRecord::Base)
|
70
|
+
active_record.extend ModelMethods
|
71
|
+
end
|
63
72
|
end
|
64
73
|
|
74
|
+
# Backwards compatible hack.
|
65
75
|
Object.const_set :SerializedAttributes, SerializableAttributes
|
66
|
-
|
data/rails_init.rb
CHANGED
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
## If your rubyforge_project name is different, then edit it and comment out
|
13
13
|
## the sub! line in the Rakefile
|
14
14
|
s.name = 'serializable_attributes'
|
15
|
-
s.version = '0.
|
16
|
-
s.date = '
|
15
|
+
s.version = '1.0.0'
|
16
|
+
s.date = '2012-05-14'
|
17
17
|
s.rubyforge_project = 'serializable_attributes'
|
18
18
|
|
19
19
|
## Make sure your summary is short. The description may be as long
|
@@ -24,15 +24,15 @@ Gem::Specification.new do |s|
|
|
24
24
|
## List the primary authors. If there are a bunch of authors, it's probably
|
25
25
|
## better to set the email to an email list or something. If you don't have
|
26
26
|
## a custom homepage, consider using your GitHub URL or the like.
|
27
|
-
s.authors = ["Rick Olson"]
|
28
|
-
s.email = 'technoweenie@gmail.com'
|
27
|
+
s.authors = ["Rick Olson", "Michael Guterl"]
|
28
|
+
s.email = ['technoweenie@gmail.com', 'michael@diminishing.org']
|
29
29
|
s.homepage = 'http://github.com/technoweenie/serialized_attributes'
|
30
30
|
|
31
31
|
## This gets added to the $LOAD_PATH so that 'lib/NAME.rb' can be required as
|
32
32
|
## require 'NAME.rb' or'/lib/NAME/file.rb' can be as require 'NAME/file.rb'
|
33
33
|
s.require_paths = %w[lib]
|
34
34
|
|
35
|
-
s.add_dependency "activerecord", [">= 2.2.0", "< 3.
|
35
|
+
s.add_dependency "activerecord", [">= 2.2.0", "< 3.3.0"]
|
36
36
|
|
37
37
|
## Leave this section as-is. It will be automatically generated from the
|
38
38
|
## contents of your Git repository via the gemspec task. DO NOT REMOVE
|
@@ -46,6 +46,7 @@ Gem::Specification.new do |s|
|
|
46
46
|
gemfiles/ar-2.3.gemfile
|
47
47
|
gemfiles/ar-3.0.gemfile
|
48
48
|
gemfiles/ar-3.1.gemfile
|
49
|
+
gemfiles/ar-3.2.gemfile
|
49
50
|
init.rb
|
50
51
|
lib/serializable_attributes.rb
|
51
52
|
lib/serializable_attributes/duplicable.rb
|
@@ -218,13 +218,20 @@ formatters.each do |fmt|
|
|
218
218
|
assert_equal true, @record.active
|
219
219
|
end
|
220
220
|
|
221
|
-
test "parses booleans from strings" do
|
221
|
+
test "parses booleans from integer like strings" do
|
222
222
|
@record.active = '1'
|
223
223
|
assert_equal true, @record.active
|
224
224
|
@record.active = '0'
|
225
225
|
assert_equal false, @record.active
|
226
226
|
end
|
227
227
|
|
228
|
+
test "parses booleans from boolean like strings" do
|
229
|
+
@record.active = 'true'
|
230
|
+
assert_equal true, @record.active
|
231
|
+
@record.active = 'false'
|
232
|
+
assert_equal false, @record.active
|
233
|
+
end
|
234
|
+
|
228
235
|
test "parses booleans from integers" do
|
229
236
|
@record.active = 1
|
230
237
|
assert_equal true, @record.active
|
metadata
CHANGED
@@ -1,36 +1,58 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: serializable_attributes
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Rick Olson
|
14
|
+
- Michael Guterl
|
9
15
|
autorequire:
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
18
|
+
|
19
|
+
date: 2012-05-14 00:00:00 Z
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
15
22
|
name: activerecord
|
16
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
17
25
|
none: false
|
18
|
-
requirements:
|
19
|
-
- -
|
20
|
-
- !ruby/object:Gem::Version
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 7
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 2
|
33
|
+
- 0
|
21
34
|
version: 2.2.0
|
22
35
|
- - <
|
23
|
-
- !ruby/object:Gem::Version
|
24
|
-
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
hash: 11
|
38
|
+
segments:
|
39
|
+
- 3
|
40
|
+
- 3
|
41
|
+
- 0
|
42
|
+
version: 3.3.0
|
25
43
|
type: :runtime
|
26
|
-
|
27
|
-
version_requirements: *70317221367420
|
44
|
+
version_requirements: *id001
|
28
45
|
description: A bridge between using AR and a full blown schema-free db.
|
29
|
-
email:
|
46
|
+
email:
|
47
|
+
- technoweenie@gmail.com
|
48
|
+
- michael@diminishing.org
|
30
49
|
executables: []
|
50
|
+
|
31
51
|
extensions: []
|
52
|
+
|
32
53
|
extra_rdoc_files: []
|
33
|
-
|
54
|
+
|
55
|
+
files:
|
34
56
|
- LICENSE
|
35
57
|
- README.md
|
36
58
|
- Rakefile
|
@@ -38,6 +60,7 @@ files:
|
|
38
60
|
- gemfiles/ar-2.3.gemfile
|
39
61
|
- gemfiles/ar-3.0.gemfile
|
40
62
|
- gemfiles/ar-3.1.gemfile
|
63
|
+
- gemfiles/ar-3.2.gemfile
|
41
64
|
- init.rb
|
42
65
|
- lib/serializable_attributes.rb
|
43
66
|
- lib/serializable_attributes/duplicable.rb
|
@@ -52,29 +75,40 @@ files:
|
|
52
75
|
- test/types_test.rb
|
53
76
|
homepage: http://github.com/technoweenie/serialized_attributes
|
54
77
|
licenses: []
|
78
|
+
|
55
79
|
post_install_message:
|
56
80
|
rdoc_options: []
|
57
|
-
|
81
|
+
|
82
|
+
require_paths:
|
58
83
|
- lib
|
59
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
85
|
none: false
|
61
|
-
requirements:
|
62
|
-
- -
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
|
65
|
-
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
90
|
+
segments:
|
91
|
+
- 0
|
92
|
+
version: "0"
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
94
|
none: false
|
67
|
-
requirements:
|
68
|
-
- -
|
69
|
-
- !ruby/object:Gem::Version
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 17
|
99
|
+
segments:
|
100
|
+
- 1
|
101
|
+
- 3
|
102
|
+
- 5
|
70
103
|
version: 1.3.5
|
71
104
|
requirements: []
|
105
|
+
|
72
106
|
rubyforge_project: serializable_attributes
|
73
|
-
rubygems_version: 1.8.
|
107
|
+
rubygems_version: 1.8.17
|
74
108
|
signing_key:
|
75
109
|
specification_version: 2
|
76
110
|
summary: Store a serialized hash of attributes in a single ActiveRecord column.
|
77
|
-
test_files:
|
111
|
+
test_files:
|
78
112
|
- test/serialized_attributes_test.rb
|
79
113
|
- test/test_helper.rb
|
80
114
|
- test/types_test.rb
|