restpack_serializer 0.5.8 → 0.5.9

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: c62e329e0e5ad1a715c774afa67cf2fa73c9ecbf
4
- data.tar.gz: a3a127d3888cf16b3b3561ad01990c1728716b88
3
+ metadata.gz: 48ad2bb0975d935d8c7862edb654645f26e7ee91
4
+ data.tar.gz: 965783d651b2f3bb9b1d37b8cab6b18064c091e5
5
5
  SHA512:
6
- metadata.gz: fb603fa7f78a4a8349bf64ecebcc4fb02f2cbd3956bd4aff643dd4450409ec98e99714bc12c307972d50def980edaa4c61e2a408a17ba043d3ad363f7d8f3b55
7
- data.tar.gz: c9631648c26608e0718b17348402eb46a6b666d165ed4773772ec37b659e9170cae5794c58e675802f2973109e9017cb8393d928fc41a1d43100e8f7493bcc0c
6
+ metadata.gz: a12cd6e72db3ad699934ff7ff5dade4f8d76514d76aef01d707949da51f7caf8628a104ccaadec3275737714beed588d91884fef81544da6e6893ec670f14d02
7
+ data.tar.gz: d3e38c875f4467d587d0b8e68329daccad67a3e368c62c84278431325a1cdeadbc8cf1dce4be1ff1720501f57d5451950c353c9a818f37bdb22680aee8043f4b
@@ -49,7 +49,8 @@ module RestPack::Serializer::Attributes
49
49
  define_method name do
50
50
  value = self.default_href if name == :href
51
51
  if @model.is_a?(Hash)
52
- value ||= @model[name] || @model[name.to_s]
52
+ value = @model[name]
53
+ value = @model[name.to_s] if value.nil?
53
54
  else
54
55
  value ||= @model.send(name)
55
56
  end
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Serializer
3
- VERSION = '0.5.8'
3
+ VERSION = '0.5.9'
4
4
  end
5
5
  end
@@ -57,13 +57,14 @@ describe RestPack::Serializer::Attributes do
57
57
  end
58
58
 
59
59
  describe "model as a hash" do
60
- let(:model) { { a: 'A', 'b' => 'B' } }
60
+ let(:model) { { a: 'A', 'b' => 'B', c: false } }
61
61
 
62
62
  subject(:as_json) { CustomSerializer.as_json(model, include_gonzaga?: false) }
63
63
 
64
64
  it 'uses the transform method on the model attribute' do
65
65
  expect(as_json[:a]).to eq('A')
66
66
  expect(as_json[:b]).to eq('B')
67
+ expect(as_json[:c]).to eq(false)
67
68
  end
68
69
  end
69
70
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.5.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-04 00:00:00.000000000 Z
11
+ date: 2015-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport