activerecord-msgpack_serializer 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1dc04f6ac21266a44e3480b40a67495e4adc6e64
4
- data.tar.gz: 3bc1e21b6b3cf42008080bb49e964921637db5ff
3
+ metadata.gz: 7f3fb3f1dba7bda0293b49ed36dad027a05550e6
4
+ data.tar.gz: 642ed0ca7469e70ca46eb90d1c714bc8848de8f7
5
5
  SHA512:
6
- metadata.gz: c185a4fdba48bc2b4d49e443b409cfda797c95e809670f76d881bb7c031091d10951e68c142d614b91d19d5d55bed2def3d31de9a75f49d6b1a8c25f81e43eed
7
- data.tar.gz: a2b936a1207333ab29e7a061bfced9d82d7d23255f2ce5c90bbbf77adb05f19a0673dcd06daba4519fbc8a9fc9646ad34e26528c016e4b58d76ec60d58f9f54d
6
+ metadata.gz: 40079825410ff372c6fb07477dfd6f4b8e0ca000b327acb7e7fe8aca72637dbe978b23dc04b7c2aa567c47999ccbd33934814818b4fcb1e678ccffd2d4be5857
7
+ data.tar.gz: 9d434698f18fdcad0e7c83e92cfa81e21aaa98e05dbeef5cf90961c29415bbda0bcf45c33296593654f13e7710677880772c4c51ed192404842d6b6335bed3c2
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ rvm:
2
+ - 1.9.3
3
+ - 2.0.0
4
+ - 2.1.0
5
+ - ruby-head
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -5,12 +5,12 @@ module Serializers
5
5
  class MessagePackSerializer
6
6
  class << self
7
7
  def load(binary)
8
- return nil if binary.match(/\A[[:space:]]*\z/)
9
- MessagePack.unpack(binary.b)
8
+ return nil if binary.nil? || binary.match(/\A[[:space:]]*\z/)
9
+ MessagePack.unpack(binary.force_encoding("ASCII-8BIT"))
10
10
  end
11
11
 
12
12
  def dump(obj)
13
- MessagePack.pack(obj).b
13
+ MessagePack.pack(obj).force_encoding("ASCII-8BIT")
14
14
  end
15
15
  end
16
16
  end
@@ -1,7 +1,7 @@
1
1
  module ActiveRecord
2
2
  module Serializers
3
3
  class MessagePackSerializer
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
@@ -6,6 +6,14 @@ describe ActiveRecord::Serializers::MessagePackSerializer do
6
6
  described_class.load(binary)
7
7
  end
8
8
 
9
+ context "with nil" do
10
+ let(:binary) do
11
+ nil
12
+ end
13
+
14
+ it { should be_nil }
15
+ end
16
+
9
17
  context "with blank data" do
10
18
  let(:binary) do
11
19
  ""
@@ -16,7 +24,7 @@ describe ActiveRecord::Serializers::MessagePackSerializer do
16
24
 
17
25
  context "with valid binary string" do
18
26
  let(:binary) do
19
- "\x92\xA3foo*".b # == ["foo", 42].to_smgpack
27
+ "\x92\xA3foo*".force_encoding("ASCII-8BIT") # == ["foo", 42].to_smgpack
20
28
  end
21
29
 
22
30
  it "returns valid data" do
@@ -35,7 +43,7 @@ describe ActiveRecord::Serializers::MessagePackSerializer do
35
43
  end
36
44
 
37
45
  it "returns valid binary string" do
38
- should == "\x92\xA3foo*".b
46
+ should == "\x92\xA3foo*".force_encoding("ASCII-8BIT")
39
47
  end
40
48
  end
41
49
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-msgpack_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shimpei Makimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-25 00:00:00.000000000 Z
11
+ date: 2013-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: activerecord
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '4.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '4.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: msgpack
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description:
@@ -101,7 +101,8 @@ executables: []
101
101
  extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
- - .gitignore
104
+ - ".gitignore"
105
+ - ".travis.yml"
105
106
  - Gemfile
106
107
  - README.md
107
108
  - Rakefile
@@ -120,21 +121,20 @@ require_paths:
120
121
  - lib
121
122
  required_ruby_version: !ruby/object:Gem::Requirement
122
123
  requirements:
123
- - - '>='
124
+ - - ">="
124
125
  - !ruby/object:Gem::Version
125
126
  version: '0'
126
127
  required_rubygems_version: !ruby/object:Gem::Requirement
127
128
  requirements:
128
- - - '>='
129
+ - - ">="
129
130
  - !ruby/object:Gem::Version
130
131
  version: '0'
131
132
  requirements: []
132
133
  rubyforge_project:
133
- rubygems_version: 2.0.2
134
+ rubygems_version: 2.2.0
134
135
  signing_key:
135
136
  specification_version: 4
136
137
  summary: A custom ActiveRecord serializer using MessagePack
137
138
  test_files:
138
139
  - spec/activerecord/serializers/message_pack_serializer_spec.rb
139
140
  - spec/spec_helper.rb
140
- has_rdoc: