dockly-util 0.0.10 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/lib/dockly/util/dsl.rb +7 -3
- data/lib/dockly/util/version.rb +1 -1
- data/spec/dockly/util/dsl_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: be8c9c895701cfec1c6000ef444e78099876cf3f
|
4
|
+
data.tar.gz: 6671e6d5317a7be96ae58b4b526a91755fa48604
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ae1fa12b434a29d7047cf6b983512d7ab7ac1aac830a82f434018e101bd5d35c8e291266253abfe1e79a33f6fd4d4f5692ae0b149c110eec4f33a0b3ab0cfcc
|
7
|
+
data.tar.gz: e26a326dbe4fda4e905e0e7d6e307566fe02863532573116bf714018bf147655b557370d89ebcb529fd08a38337cd82134cdd1bcf1b00918e66c6fc1b67eb4a0
|
data/.travis.yml
CHANGED
data/lib/dockly/util/dsl.rb
CHANGED
@@ -14,9 +14,13 @@ module Dockly::Util::DSL
|
|
14
14
|
|
15
15
|
def dsl_attribute(*names)
|
16
16
|
names.each do |name|
|
17
|
-
define_method(name) do |val = nil|
|
18
|
-
val.nil? ?
|
19
|
-
|
17
|
+
define_method(name) do |val = nil, &block|
|
18
|
+
val_or_block = val.nil? ? block : val
|
19
|
+
if val_or_block.nil?
|
20
|
+
instance_variable_get(:"@#{name}")
|
21
|
+
else
|
22
|
+
instance_variable_set(:"@#{name}", val_or_block)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
end
|
data/lib/dockly/util/version.rb
CHANGED
@@ -50,6 +50,14 @@ describe Dockly::Util::DSL do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
+
context 'with a block' do
|
54
|
+
it 'sets the corresponding instance variable to the block' do
|
55
|
+
expect { test_instance.chips { 'test' } }
|
56
|
+
.to change { test_instance.instance_variable_get(:@chips) }
|
57
|
+
expect(test_instance.chips.call).to eq('test')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
53
61
|
end
|
54
62
|
end
|
55
63
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dockly-util
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Swipely, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|