cyrax 0.7.5 → 0.7.6

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: 6e5f735826c558a7f4fa5b23910e1919c4e43b2b
4
- data.tar.gz: 281c7225738c63b7b9e41725f2e14c1092ec721d
3
+ metadata.gz: 68400307bdf12d9d45af934449153f9c9db3b469
4
+ data.tar.gz: eb41c514e1f0d1912a24bb9e821d5de0227fd2bb
5
5
  SHA512:
6
- metadata.gz: e47c1e63406636e35d085ebfa824e30b1f4931f9751dea52e4fe4d2be1cf18d667a5bd554efa88fbfd2a30f0c7a85299c076cbfeef6ed52a04ea49ccc87680af
7
- data.tar.gz: 7e2cec99408da893526907ad316eb08e52a39cf36ec46258cb95ff2adc25c1d7155ee147936edf6a3a5dd73f73fff2bcc82a63233a3bd40acfaddf58c1558fea
6
+ metadata.gz: 40f9eb8bdf2d4468fa30375949cf6699b2b01f8c292bde03f75fe8df30481bf5701ff690cd903adb4480d8e0248008f614b84d8ae94ebfeff7a9c3873262d269
7
+ data.tar.gz: 68935cebf9fd21dbaa4205c62057194ecfb728c55b6261a34e385f1afebb10c7025ab37bf33ff6aa19af5c9f12ecd5e2f6d32c2f9817476a24ca60914b2655d9
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Cyrax [![Build Status](https://travis-ci.org/droidlabs/cyrax.png)](https://travis-ci.org/droidlabs/cyrax) [![Code Climate](https://codeclimate.com/github/droidlabs/cyrax.png)](https://codeclimate.com/github/droidlabs/cyrax) [![Roadchange](http://roadchange.com/droidlabs/cyrax/badge.png)](http://roadchange.com/droidlabs/cyrax)
1
+ # Cyrax [![Build Status](https://travis-ci.org/droidlabs/cyrax.png)](https://travis-ci.org/droidlabs/cyrax) [![Code Climate](https://codeclimate.com/github/droidlabs/cyrax.png)](https://codeclimate.com/github/droidlabs/cyrax) [![Roadchange](http://roadchange.com/droidlabs/cyrax/badge.png)](http://roadchange.com/droidlabs/cyrax)
2
2
  ![Cyrax](http://images2.wikia.nocookie.net/__cb20121118042055/mk/images/thumb/4/44/CyraxMK9Render.png/322px-CyraxMK9Render.png)
3
3
  > Safeties disabled; combat mode engaged.
4
4
 
@@ -10,7 +10,7 @@ Add this line to your Gemfile.
10
10
 
11
11
  Rails 4:
12
12
 
13
- gem 'cyrax', '~> 0.7.3'
13
+ gem 'cyrax', '~> 0.7.6'
14
14
 
15
15
  Rails 3:
16
16
 
@@ -47,7 +47,9 @@ module Cyrax::Serializers
47
47
  end
48
48
 
49
49
  def serialize(resource, options = {})
50
- if resource.respond_to?(:to_a)
50
+ if resource.nil?
51
+ nil
52
+ elsif resource.respond_to?(:to_a)
51
53
  resource.to_a.map{ |r| serialize_one(r, options) }
52
54
  else
53
55
  serialize_one(resource, options)
@@ -1,3 +1,3 @@
1
1
  module Cyrax
2
- VERSION = "0.7.5"
2
+ VERSION = "0.7.6"
3
3
  end
@@ -8,16 +8,25 @@ class FooSerializer < Cyrax::Serializer
8
8
  relation :another do
9
9
  attributes :another_foo, :another_bar
10
10
  end
11
+ relation :empty_relation_many do
12
+ attributes :another_foo, :another_bar
13
+ end
14
+ relation :empty_relation_one do
15
+ attributes :another_foo, :another_bar
16
+ end
11
17
  end
12
18
 
13
19
  module Cyrax
14
20
  describe FooSerializer do
15
- let(:serializable) {
21
+ let(:serializable) {
16
22
  double(
17
23
  name: 'me',
18
24
  foo: '2342',
19
25
  bar: '4223',
20
- another: double(another_foo: '1234', another_bar: '1234'))
26
+ another: double(another_foo: '1234', another_bar: '1234'),
27
+ empty_relation_one: nil,
28
+ empty_relation_many: []
29
+ )
21
30
  }
22
31
  subject { FooSerializer.new(serializable).serialize }
23
32
 
@@ -25,6 +34,8 @@ module Cyrax
25
34
  subject[:name].should eq('me')
26
35
  subject[:some][:foo].should eq('2342')
27
36
  subject[:another][:another_foo].should eq('1234')
37
+ subject[:empty_relation_one].should eq(nil)
38
+ subject[:empty_relation_many].should eq([])
28
39
  end
29
40
  end
30
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Droidlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-08 00:00:00.000000000 Z
11
+ date: 2015-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport