serialize_with_coder 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/README.md +48 -0
- data/Rakefile +10 -0
- data/lib/serialize_with_coder.rb +2 -0
- data/test/test_helper.rb +0 -2
- metadata +8 -6
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
Serialize with Coder
|
2
|
+
====================
|
3
|
+
|
4
|
+
serialize_with_coder is an ActiveRecord 2.x extended serialize function which acts like Rails 3.1 one - you can use custom coder as storing engine.
|
5
|
+
|
6
|
+
Including 2 sample coders:
|
7
|
+
|
8
|
+
- CSV, SerializeWithCoder::CSVCoder
|
9
|
+
- JSON, SerializeWithCoder::JSONCoder
|
10
|
+
|
11
|
+
Example
|
12
|
+
-------
|
13
|
+
|
14
|
+
require 'coders/csv_coder'
|
15
|
+
require 'coders/json_coder'
|
16
|
+
|
17
|
+
class User < ActiveRecord::Base
|
18
|
+
|
19
|
+
serialize_with_coder :newsletters, SerializeWithCoder::CSVCoder.new
|
20
|
+
serialize_with_coder :notes, SerializeWithCoder::JSONCoder.new
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
Example coder
|
25
|
+
-------------
|
26
|
+
|
27
|
+
class JSONCoder
|
28
|
+
def load(data)
|
29
|
+
JSON.parse(data) rescue nil
|
30
|
+
end
|
31
|
+
|
32
|
+
def dump(obj)
|
33
|
+
obj.to_json rescue nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
Installation
|
38
|
+
------------
|
39
|
+
|
40
|
+
gem install serialize_with_coder
|
41
|
+
|
42
|
+
Note
|
43
|
+
----
|
44
|
+
Please open an issue at http://github.com/maltize/serialize_with_coder if you discover a problem.
|
45
|
+
|
46
|
+
* * *
|
47
|
+
|
48
|
+
Copyright (c) 2011 Maciej Gajek, released under the MIT license.
|
data/Rakefile
ADDED
data/lib/serialize_with_coder.rb
CHANGED
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serialize_with_coder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Maciej Gajek
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-13 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -60,7 +60,7 @@ dependencies:
|
|
60
60
|
version: "0"
|
61
61
|
type: :development
|
62
62
|
version_requirements: *id003
|
63
|
-
description: serialize_with_coder is an ActiveRecord extended serialize function which acts like Rails 3.1 one - you can use custom coder as storing engine. Including 2 sample coders - CSV and JSON.
|
63
|
+
description: serialize_with_coder is an ActiveRecord 2.x extended serialize function which acts like Rails 3.1 one - you can use custom coder as storing engine. Including 2 sample coders - CSV and JSON.
|
64
64
|
email: maltize@gmail.com
|
65
65
|
executables: []
|
66
66
|
|
@@ -69,11 +69,13 @@ extensions: []
|
|
69
69
|
extra_rdoc_files: []
|
70
70
|
|
71
71
|
files:
|
72
|
+
- lib/serialize_with_coder.rb
|
72
73
|
- lib/coders/csv_coder.rb
|
73
74
|
- lib/coders/json_coder.rb
|
74
|
-
- lib/serialize_with_coder.rb
|
75
75
|
- test/serialize_with_coder_test.rb
|
76
76
|
- test/test_helper.rb
|
77
|
+
- Rakefile
|
78
|
+
- README.md
|
77
79
|
has_rdoc: true
|
78
80
|
homepage: https://github.com/maltize/serialize_with_coder
|
79
81
|
licenses: []
|