tainbox 0.2.6 → 0.2.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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/tainbox/attribute_definer.rb +7 -3
- data/lib/tainbox/extensions.rb +4 -0
- data/lib/tainbox/version.rb +1 -1
- 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: 3fc20a0ada50ebd418d6bb4d319059f5689d267f
|
4
|
+
data.tar.gz: 1c35da834f88c56c09fc984f1fda8a1b2c624e0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd4cca5f880887aa74572ecf8e1ed79d1681b8d5eea364dd481b1b3613e23ef3d04cdef5db1c473a173774660681f571a35969671a3674ec9671ce05d39e4aec
|
7
|
+
data.tar.gz: 7d1db5b7e11fc1ff950d5ba1eb536ac758fc88c12413b3981c2daa711c6a8f1857b17823934451bd5658ed55dd790872b347e043ce082f9fff365b4a2b34d4d2
|
data/CHANGELOG.md
CHANGED
@@ -11,3 +11,12 @@
|
|
11
11
|
## 0.2.6
|
12
12
|
|
13
13
|
* raise `ArgumentError` if trying to assign a non-hash to `#attributes`
|
14
|
+
|
15
|
+
## 0.2.7
|
16
|
+
|
17
|
+
* Attribute is always set to nil and marked as not provided when the hash assigned via
|
18
|
+
`#attributes=` or `#new` does not have that attribute and the attribute does not have a default
|
19
|
+
|
20
|
+
## 0.2.8
|
21
|
+
|
22
|
+
* Prepend internal variables with 'tainbox\_' to avoid clashes with client code
|
@@ -19,7 +19,7 @@ class Tainbox::AttributeDefiner
|
|
19
19
|
|
20
20
|
klass.tainbox_layer.instance_eval do
|
21
21
|
define_method(attribute) do
|
22
|
-
value = instance_variable_get(:"
|
22
|
+
value = instance_variable_get(:"@tainbox_#{attribute}")
|
23
23
|
value.is_a?(Tainbox::DeferredValue) ? instance_exec(&value.proc) : value
|
24
24
|
end
|
25
25
|
end
|
@@ -37,7 +37,7 @@ class Tainbox::AttributeDefiner
|
|
37
37
|
define_method("#{attribute}=") do |value|
|
38
38
|
tainbox_register_attribute_provided(attribute)
|
39
39
|
value = Tainbox::TypeConverter.new(type, value, options: args).convert if type
|
40
|
-
instance_variable_set(:"
|
40
|
+
instance_variable_set(:"@tainbox_#{attribute}", value)
|
41
41
|
end
|
42
42
|
|
43
43
|
define_method("tainbox_set_default_#{attribute}") do
|
@@ -45,7 +45,11 @@ class Tainbox::AttributeDefiner
|
|
45
45
|
tainbox_register_attribute_provided(attribute)
|
46
46
|
value = args[:default].deep_dup
|
47
47
|
value = Tainbox::DeferredValue.new(value) if value.is_a?(Proc)
|
48
|
-
instance_variable_set(:"
|
48
|
+
instance_variable_set(:"@tainbox_#{attribute}", value)
|
49
|
+
|
50
|
+
else
|
51
|
+
tainbox_unregister_attribute_provided(attribute)
|
52
|
+
instance_variable_set(:"@tainbox_#{attribute}", nil)
|
49
53
|
end
|
50
54
|
end
|
51
55
|
end
|
data/lib/tainbox/extensions.rb
CHANGED
data/lib/tainbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tainbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Gubitskiy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|