blockhead 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/blockhead/marshaller.rb +5 -1
- data/lib/blockhead/version.rb +1 -1
- data/spec/blockhead/schema_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53eb88ab447f317759654458a6a549a29994d9de
|
4
|
+
data.tar.gz: b4caaf07cfd3f966e6f09cfdbe84b9445fefc991
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3728ce96b5187c29a7109dd8b383ab0e872ef281d1448917be8063548fe27c44aa329210e80dedd9993bbe9286ca39629ebd07cc9d0d4a316f33a655a25fba69
|
7
|
+
data.tar.gz: b114e8bd9b8aa04598bac284f8b942574fd48eb32ada9509ff9cf64c9a63001bab7656a0313875b7abd20c6be0d655244f12be90d9aaead87e1bf1f16731212b
|
data/lib/blockhead/marshaller.rb
CHANGED
@@ -22,9 +22,13 @@ module Blockhead
|
|
22
22
|
def _call(name)
|
23
23
|
if @arg == :wrap
|
24
24
|
object
|
25
|
-
elsif
|
25
|
+
elsif valid_message?(name)
|
26
26
|
object.send name
|
27
27
|
end
|
28
28
|
end
|
29
|
+
|
30
|
+
def valid_message?(name)
|
31
|
+
object.respond_to?(name) && !object.nil? # nil responds to :id in Rails.
|
32
|
+
end
|
29
33
|
end
|
30
34
|
end
|
data/lib/blockhead/version.rb
CHANGED
@@ -50,6 +50,16 @@ describe Blockhead::Schema, '::define' do
|
|
50
50
|
expect(schema.marshal).to eq response
|
51
51
|
end
|
52
52
|
|
53
|
+
it 'handles :id when nil responds to id (Rails)' do
|
54
|
+
allow(nil).to receive(:respond_to?).with(:id).and_return(true)
|
55
|
+
|
56
|
+
schema = Blockhead::Schema.define nil do
|
57
|
+
id
|
58
|
+
end
|
59
|
+
|
60
|
+
expect(schema.marshal).to eq(id: nil)
|
61
|
+
end
|
62
|
+
|
53
63
|
it 'handles wrappers' do
|
54
64
|
schema = schema_with do
|
55
65
|
surprise :wrap do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blockhead
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vincent Franco
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|