restpack_serializer 0.6.4 → 0.6.5

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: 637bfafd73311f2c1dc436e0e39c6b8a50c1be80
4
- data.tar.gz: c289ea1c60720cde17d4d42b5cf01d7badc85fba
3
+ metadata.gz: 7b7353b8336e2522e29fd3f7d784cb3d0b7700aa
4
+ data.tar.gz: d82b914f3692048c54b3725f8909c40c469b4a0f
5
5
  SHA512:
6
- metadata.gz: 877854ce2c5087a9ff2d932df36405f7ee9463de7a9372e66bd5f66a23b9f830259451f6b9bde92f20189dead4c7f2a7790ea926a489ee1cafe19fe231752842
7
- data.tar.gz: 825c0a666ed9b6afb31346083e7536a233a5ce654ac2a4efe3d0ef73b5926616621d0586162ea71fd8c59fc1231d6bae743a9be73482f208713941c643d59662
6
+ metadata.gz: 3e188183204596a3010a77922b7ce1bf7567dc5a2e9935f503bab9b10147f9cf5be77cdd678dead2ce697bfaefeb8f02641049329526af0a84a73efc035f5d40
7
+ data.tar.gz: f2da61ed3c6ec04db90bd9a5720e1d983f9a71c341d355e474f3849ec85e77fa0963b79177f8019397ccd8ab775a65b9d5987d12d4c10b865cffa783628c16b3
@@ -38,7 +38,7 @@ module RestPack
38
38
  end
39
39
 
40
40
  @model, @context = model, context
41
- user_defined_methods = self.class.user_defined_methods
41
+ user_defined_methods = self.class.user_defined_methods || []
42
42
 
43
43
  data = {}
44
44
  if self.class.serializable_attributes.present?
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Serializer
3
- VERSION = '0.6.4'
3
+ VERSION = '0.6.5'
4
4
  end
5
5
  end
@@ -31,6 +31,33 @@ describe RestPack::Serializer do
31
31
  end
32
32
  end
33
33
 
34
+ context "serializer inheritance" do
35
+ class BaseSerializer
36
+ include RestPack::Serializer
37
+ attributes :name
38
+
39
+ def name
40
+ "Ben"
41
+ end
42
+
43
+ def age
44
+ -2
45
+ end
46
+ end
47
+
48
+ class DerivedSerializer < BaseSerializer
49
+ attributes :name, :age
50
+
51
+ def age
52
+ 1
53
+ end
54
+ end
55
+
56
+ it ".as_json serializes" do
57
+ DerivedSerializer.as_json(person).should == { name: "Ben", age: 1 }
58
+ end
59
+ end
60
+
34
61
  class PersonSerializer
35
62
  include RestPack::Serializer
36
63
  attributes :id, :name, :description, :href, :admin_info, :string_keys
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce