nested 0.0.19 → 0.0.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nested.rb +13 -1
  3. data/nested.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8587a183881483c3160f9a99f53a66128d76708b
4
- data.tar.gz: f8823b40b5451b73ec9381955c84f552f3d46a04
3
+ metadata.gz: 1a7ac105733a5c7bab517c0414c54f7483d1c0d8
4
+ data.tar.gz: c4d0bb6b2bfb8d18eee1a2257b4fb960b4dc7833
5
5
  SHA512:
6
- metadata.gz: 66c73d96f3b3bdb646868926b6da8ab3babd65a48579dc85077f827425a22afa45823928bcf629c591688cd21e8b1ea5ae0ebf150941f9bb578b7c09b8bf2c24
7
- data.tar.gz: 32b6e84c7e4d7e61bf4cfb60a8f26128356fd62749a24ac2998d4136ad79d0f9641925890616179f52ae4c01641082df5e1913ca7ff847cfa7f3cfd678b48508
6
+ metadata.gz: cd3a6acb935adc5433038f07a72a5b50bb45ad9ca699ed2355762ab2dbba74c36ee78681bcfa5cb699c41c1af84e243b8f51860a9f52b6df8e4c2cbdee300676
7
+ data.tar.gz: 7a95f0db8cfa7931a7a0b214e9f35ccf275fb781660be0fd0d6276f32cbf3a82958bac8f81c9949a18e6a7f3fcbf7a586309e0f0bae55afa47dbe07a714e45c4
data/lib/nested.rb CHANGED
@@ -65,7 +65,7 @@ module Nested
65
65
 
66
66
  serialize *__serialize_args, &__serialize_block
67
67
  else
68
- serialize &->(obj) { obj }
68
+ serialize &->(obj) { raise "implement serializer for #{@__resource.type} #{@__resource.name}" }
69
69
  end
70
70
  end
71
71
 
@@ -81,6 +81,18 @@ module Nested
81
81
  @collection == true
82
82
  end
83
83
 
84
+ def type
85
+ if singleton?
86
+ :singleton
87
+ elsif member?
88
+ :member
89
+ elsif collection?
90
+ :collection
91
+ else
92
+ raise "undefined"
93
+ end
94
+ end
95
+
84
96
  def serialize(*args, &block)
85
97
  raise "pass either *args or &block" if args.empty? && !block && !member?
86
98
 
data/nested.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "nested"
3
- s.version = "0.0.19"
3
+ s.version = "0.0.20"
4
4
 
5
5
  s.authors = ["Jan Zimmek"]
6
6
  s.email = %q{jan.zimmek@web.de}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nested
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Zimmek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-03 00:00:00.000000000 Z
11
+ date: 2013-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport