attire 0.1.2 → 0.1.3

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: 6534d8adf28c8358c5da8bec3a8b98191335a640
4
- data.tar.gz: 6a82d12b2d96b8644de663e072741dc6d41832f6
3
+ metadata.gz: 3a08fce3f81d2d6cc8e85c5c3bce1c57792e6351
4
+ data.tar.gz: 056bb3398521ecd68c08e0da79748f9131824298
5
5
  SHA512:
6
- metadata.gz: 1c49f34f6c80ab98424ecb603222d5dd0e97e7762e0fc7be6a50ba590eeef4dbf3d1a27f42de6d89152957e873bc0e00aef19e07c37cbd3fd0afed086f26dd03
7
- data.tar.gz: 41cb44dddd2db57edda7e5a7fbc720beb65f9175bab7362b22024169a9024669e602c30b0bd3b85837c2ae59eb5f69e9253e0f43d2691e70d5166df8cc6be949
6
+ metadata.gz: 84b6ed2e93f4808e9d34e1c00ce7729f314d43676a0bb19cbd9c0d3d33b880255488bebaaead32995c126f46d0f20e6469aed86826c74a2691a6a76d0b60417d
7
+ data.tar.gz: a8e2f70658231f95e5461dd5a00138071f6be4a5aab8d4ff18968ef4065c9b54cbf5e7250c4f37ac0a2d251e026c293bf9c5e1f8a57b2f02eb4eafa966a559f5
@@ -0,0 +1,32 @@
1
+ class Object
2
+ def duplicable?; true end
3
+ end
4
+
5
+ class NilClass
6
+ def duplicable?; false end
7
+ end
8
+
9
+ class FalseClass
10
+ def duplicable?; false end
11
+ end
12
+
13
+ class TrueClass
14
+ def duplicable?; false end
15
+ end
16
+
17
+ class Symbol
18
+ def duplicable?; false end
19
+ end
20
+
21
+ class Numeric
22
+ def duplicable?; false end
23
+ end
24
+
25
+ require 'bigdecimal'
26
+ class BigDecimal
27
+ def duplicable?; true end
28
+ end
29
+
30
+ class Method
31
+ def duplicable?; false end
32
+ end
@@ -1,3 +1,5 @@
1
+ require 'attire/core_ext/duplicable'
2
+
1
3
  module Attire
2
4
  class Initializer
3
5
  def initialize(names, splat_name, block_name, after_initialize)
@@ -33,7 +35,8 @@ module Attire
33
35
  values ||= {}
34
36
  hash_check(values)
35
37
  defaults.each do |name, default|
36
- set_ivar(name, values[name].nil? ? default : values[name])
38
+ next set_ivar(name, values[name]) unless values[name].nil?
39
+ set_ivar(name, default.duplicable? ? default.dup : default)
37
40
  end
38
41
  end
39
42
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max White
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -40,6 +40,7 @@ files:
40
40
  - README.md
41
41
  - lib/attire.rb
42
42
  - lib/attire/attr_init.rb
43
+ - lib/attire/core_ext/duplicable.rb
43
44
  - lib/attire/initializer.rb
44
45
  homepage:
45
46
  licenses: