bound 0.0.3 → 0.0.4

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: abad97e3b3b8e96cf9b42a0775bb12fdd347b325
4
- data.tar.gz: d8e735b724ae91ba5745d3ee090840f073541c2d
3
+ metadata.gz: e07d85a571ce0e21e25fe723b5ab06b6d97344a0
4
+ data.tar.gz: ecc7ccb58e70d4a9d07a5b66055e8b90345e018d
5
5
  SHA512:
6
- metadata.gz: c8d7902861b1dad1ee41a1fa2d7fcc372a0e045bb8da9c55eee63283b415ab049effb939917a16a34e7233addf729216d2cdbf75534c3a41e6deb5e36a5db6a1
7
- data.tar.gz: 69eeba09a438642aa2b618055158326d632383c9b825f6bf6d1a744e78af8ea1d95ad7470e75147f6be2acc60ff29ef472534934575a408a2c64340bab313cad
6
+ metadata.gz: 93d3d35a5b23cdcdadb628e3daf2e41fc90cb937c16d4762bd023b0ba4638ce34f35c83fb8a247e0858b5a14c44b737a9b5e8ddf7a07b71f8217a05997126740
7
+ data.tar.gz: 3255a3b9c99ef7243decccbd7a27ee80a20bb01bbb3f883396cb45de32fc36ebe764a86f7e993e363bd85080ce2d2a6890478a957591c8eab463b4d2523b6569
@@ -18,23 +18,17 @@ class Bound
18
18
  attr_accessor :attributes, :optionals
19
19
 
20
20
  def set_attributes(*attributes)
21
- attributes = attributes.dup
21
+ self.attributes = attributes
22
+ attr_accessor *attributes
22
23
 
23
- optionals = extract_optionals(attributes)
24
+ self.optionals = []
25
+ end
24
26
 
27
+ def optional(*optionals)
25
28
  self.optionals = optionals
26
- attr_accessor(*optionals)
27
-
28
- self.attributes = attributes
29
- attr_accessor(*attributes)
30
- end
29
+ attr_accessor *optionals
31
30
 
32
- def extract_optionals(attributes)
33
- if attributes.last.kind_of? Hash
34
- attributes.pop[:optional]
35
- else
36
- []
37
- end
31
+ self
38
32
  end
39
33
 
40
34
  alias :build :new
@@ -1,3 +1,3 @@
1
1
  class Bound
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -56,7 +56,7 @@ describe Bound do
56
56
  end
57
57
 
58
58
  describe 'optional attributes' do
59
- UserWithoutAge = Bound.new(:name, :optional => [:age])
59
+ UserWithoutAge = Bound.new(:name).optional(:age)
60
60
 
61
61
  it 'sets optional attributes' do
62
62
  [hash, object].each do |subject|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bound
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakob Holderbaum