ar-serialize-helpers 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -0
- data/ar-serialize-helpers.gemspec +1 -0
- data/lib/ar-serialize-helpers/gzip.rb +16 -0
- data/lib/ar-serialize-helpers/version.rb +1 -1
- data/spec/ar-serialize-helpers/gzip_spec.rb +33 -0
- metadata +24 -11
data/README.md
CHANGED
@@ -15,6 +15,13 @@ And then execute:
|
|
15
15
|
Or install it yourself as:
|
16
16
|
|
17
17
|
$ gem install ar-serialize-helpers
|
18
|
+
|
19
|
+
## Supported serialization formats
|
20
|
+
|
21
|
+
* `ARSerializeHelpers::Gzip`, depends on the `gzip` gem and a `binary` attribute for storage
|
22
|
+
* `ARSerializeHelpers::Integer`
|
23
|
+
* `ARSerializeHelpers::JSON`, depends on `JSON` being available
|
24
|
+
|
18
25
|
|
19
26
|
## Usage
|
20
27
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "gzip"
|
3
|
+
require "ar-serialize-helpers/gzip"
|
4
|
+
|
5
|
+
describe ARSerializeHelpers::Gzip do
|
6
|
+
before { @gz = ARSerializeHelpers::Gzip.new }
|
7
|
+
|
8
|
+
def long_text
|
9
|
+
"Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Cras mattis consectetur purus sit amet fermentum. Nullam quis risus eget urna mollis ornare vel eu leo. Integer posuere erat a ante venenatis dapibus posuere velit aliquet. Etiam porta sem malesuada magna mollis euismod."
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "#dump" do
|
13
|
+
it "should dump a large bit of text successfully" do
|
14
|
+
@gz.dump(long_text).gunzip.should be == long_text
|
15
|
+
end
|
16
|
+
it "should not dump nil" do
|
17
|
+
@gz.dump(nil).should be_nil
|
18
|
+
end
|
19
|
+
it "should not dump an integer" do
|
20
|
+
@gz.dump(10).should be == 10
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#load" do
|
25
|
+
it "should load integer successfully" do
|
26
|
+
@gz.load(long_text.gzip).should be == long_text
|
27
|
+
end
|
28
|
+
it "should parse nil to nil" do
|
29
|
+
@gz.load(nil).should be_nil
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 1
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 1.0.0
|
9
|
+
version: 1.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Caius Durling
|
@@ -14,14 +14,13 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2012-01-
|
17
|
+
date: 2012-01-23 00:00:00 +00:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
24
|
requirements:
|
26
25
|
- - ">="
|
27
26
|
- !ruby/object:Gem::Version
|
@@ -31,10 +30,9 @@ dependencies:
|
|
31
30
|
type: :development
|
32
31
|
version_requirements: *id001
|
33
32
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
33
|
+
name: gzip
|
35
34
|
prerelease: false
|
36
35
|
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
-
none: false
|
38
36
|
requirements:
|
39
37
|
- - ">="
|
40
38
|
- !ruby/object:Gem::Version
|
@@ -43,6 +41,18 @@ dependencies:
|
|
43
41
|
version: "0"
|
44
42
|
type: :development
|
45
43
|
version_requirements: *id002
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: rspec
|
46
|
+
prerelease: false
|
47
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
segments:
|
52
|
+
- 0
|
53
|
+
version: "0"
|
54
|
+
type: :development
|
55
|
+
version_requirements: *id003
|
46
56
|
description: Helpers for ActiveRecord's serialize in rails 3
|
47
57
|
email:
|
48
58
|
- caius@emberads.com
|
@@ -62,9 +72,11 @@ files:
|
|
62
72
|
- ar-serialize-helpers.gemspec
|
63
73
|
- lib/ar-serialize-helpers.rb
|
64
74
|
- lib/ar-serialize-helpers/all.rb
|
75
|
+
- lib/ar-serialize-helpers/gzip.rb
|
65
76
|
- lib/ar-serialize-helpers/integer.rb
|
66
77
|
- lib/ar-serialize-helpers/json.rb
|
67
78
|
- lib/ar-serialize-helpers/version.rb
|
79
|
+
- spec/ar-serialize-helpers/gzip_spec.rb
|
68
80
|
- spec/ar-serialize-helpers/integer_spec.rb
|
69
81
|
- spec/ar-serialize-helpers/json_spec.rb
|
70
82
|
- spec/spec_helper.rb
|
@@ -78,7 +90,6 @@ rdoc_options: []
|
|
78
90
|
require_paths:
|
79
91
|
- lib
|
80
92
|
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
93
|
requirements:
|
83
94
|
- - ">="
|
84
95
|
- !ruby/object:Gem::Version
|
@@ -86,7 +97,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
97
|
- 0
|
87
98
|
version: "0"
|
88
99
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
100
|
requirements:
|
91
101
|
- - ">="
|
92
102
|
- !ruby/object:Gem::Version
|
@@ -96,9 +106,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
106
|
requirements: []
|
97
107
|
|
98
108
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.3.
|
109
|
+
rubygems_version: 1.3.6
|
100
110
|
signing_key:
|
101
111
|
specification_version: 3
|
102
112
|
summary: Helpers for ActiveRecord's serialize in rails 3
|
103
|
-
test_files:
|
104
|
-
|
113
|
+
test_files:
|
114
|
+
- spec/ar-serialize-helpers/gzip_spec.rb
|
115
|
+
- spec/ar-serialize-helpers/integer_spec.rb
|
116
|
+
- spec/ar-serialize-helpers/json_spec.rb
|
117
|
+
- spec/spec_helper.rb
|