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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d7ab03eeec2b61c8fe4fc390e0d198c9028a116
4
- data.tar.gz: aab38b6cb40cda9088f5614f1f3c8a2b68b0a344
3
+ metadata.gz: be8c9c895701cfec1c6000ef444e78099876cf3f
4
+ data.tar.gz: 6671e6d5317a7be96ae58b4b526a91755fa48604
5
5
  SHA512:
6
- metadata.gz: 3b19d719a8e5b93d6aed73a821a3449fa9a24cacb036e9fb1ba331308346c4e4db4d1144521b7e8ff0a52f9846f8e57de40cccc24f5e1dd31774d9f8ae0ce6d5
7
- data.tar.gz: 77733f1d7e978afba4c9c099ba6e79476a4b8fd577477b188d494952006eea11f8c5eb109f822aa797468f229da35dff8212f29988fb17a50ec9163a675b3760
6
+ metadata.gz: 8ae1fa12b434a29d7047cf6b983512d7ab7ac1aac830a82f434018e101bd5d35c8e291266253abfe1e79a33f6fd4d4f5692ae0b149c110eec4f33a0b3ab0cfcc
7
+ data.tar.gz: e26a326dbe4fda4e905e0e7d6e307566fe02863532573116bf714018bf147655b557370d89ebcb529fd08a38337cd82134cdd1bcf1b00918e66c6fc1b67eb4a0
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.2
4
3
  - 1.9.3
5
4
  - 2.0.0
6
5
  script: bundle exec rake
@@ -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? ? instance_variable_get(:"@#{name}")
19
- : instance_variable_set(:"@#{name}", val)
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
@@ -1,5 +1,5 @@
1
1
  module Dockly
2
2
  module Util
3
- VERSION = '0.0.10'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
@@ -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.10
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-01-20 00:00:00.000000000 Z
11
+ date: 2015-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake