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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53eb88ab447f317759654458a6a549a29994d9de
4
- data.tar.gz: b4caaf07cfd3f966e6f09cfdbe84b9445fefc991
3
+ metadata.gz: 1bfa6acee8e47767ffe7fa028f60442969678c6b
4
+ data.tar.gz: 15e3a9ec1e85976856297713d75c85810e1383f4
5
5
  SHA512:
6
- metadata.gz: 3728ce96b5187c29a7109dd8b383ab0e872ef281d1448917be8063548fe27c44aa329210e80dedd9993bbe9286ca39629ebd07cc9d0d4a316f33a655a25fba69
7
- data.tar.gz: b114e8bd9b8aa04598bac284f8b942574fd48eb32ada9509ff9cf64c9a63001bab7656a0313875b7abd20c6be0d655244f12be90d9aaead87e1bf1f16731212b
6
+ metadata.gz: cb260cba8a9d3f8ea127df9814819e2c5df20be96e0caaa33d8f7e39e4bd6ab74c428a94e977af6f52f651593df852dcdd650abda34232f8662c185e2ce32e5d
7
+ data.tar.gz: 48295571ea0e7290aa96d000e047373c3edcd7187e21e308e20ae89bc4b56706d7584103cbd442a2c58b7863b84aaf661021817143d794f4e867684e77dea438
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Blockhead
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
@@ -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.7
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-07-24 00:00:00.000000000 Z
11
+ date: 2014-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler