blockhead 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/blockhead/option_key.rb +11 -2
- data/lib/blockhead/version.rb +1 -1
- data/spec/blockhead/schema_spec.rb +8 -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: 1bfa6acee8e47767ffe7fa028f60442969678c6b
|
|
4
|
+
data.tar.gz: 15e3a9ec1e85976856297713d75c85810e1383f4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cb260cba8a9d3f8ea127df9814819e2c5df20be96e0caaa33d8f7e39e4bd6ab74c428a94e977af6f52f651593df852dcdd650abda34232f8662c185e2ce32e5d
|
|
7
|
+
data.tar.gz: 48295571ea0e7290aa96d000e047373c3edcd7187e21e308e20ae89bc4b56706d7584103cbd442a2c58b7863b84aaf661021817143d794f4e867684e77dea438
|
data/lib/blockhead/option_key.rb
CHANGED
|
@@ -8,6 +8,14 @@ module Blockhead
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def key
|
|
11
|
+
key = extract_key
|
|
12
|
+
raise AliasOptionException unless key
|
|
13
|
+
key
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
|
|
18
|
+
def extract_key
|
|
11
19
|
if options?
|
|
12
20
|
options[:as]
|
|
13
21
|
else
|
|
@@ -15,10 +23,11 @@ module Blockhead
|
|
|
15
23
|
end
|
|
16
24
|
end
|
|
17
25
|
|
|
18
|
-
private
|
|
19
|
-
|
|
20
26
|
def options?
|
|
21
27
|
options.is_a?(Hash)
|
|
22
28
|
end
|
|
23
29
|
end
|
|
24
30
|
end
|
|
31
|
+
|
|
32
|
+
class AliasOptionException < Exception
|
|
33
|
+
end
|
data/lib/blockhead/version.rb
CHANGED
|
@@ -124,6 +124,14 @@ describe Blockhead::Schema, '::define' do
|
|
|
124
124
|
expect(schema.marshal).to eq 'header' => 'Title', 'body' => 'Description'
|
|
125
125
|
end
|
|
126
126
|
|
|
127
|
+
it 'raises AliasOptionException on nil aliases' do
|
|
128
|
+
expect {
|
|
129
|
+
schema_with do
|
|
130
|
+
title as: header
|
|
131
|
+
end
|
|
132
|
+
}.to raise_error
|
|
133
|
+
end
|
|
134
|
+
|
|
127
135
|
it 'accepts procs' do
|
|
128
136
|
schema = schema_with do
|
|
129
137
|
summary -> { "#{object.title} #{object.description}" }
|
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.8
|
|
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-
|
|
11
|
+
date: 2014-09-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|