l43_open_object 0.2.2 → 0.2.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 +4 -4
- data/lib/l43/open_object/behavior.rb +16 -0
- data/lib/l43/open_object.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 10bdaa5f61e9a0308915ebc819a135797dffd5e42c903387400422aed4250144
|
|
4
|
+
data.tar.gz: 750a314d9770f6cacfde3ca3427332a4bd9ddf534bef2f3493c235a23f4addfa
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e0fff087431d0d1104b97c7b6df5acd4c5335db87b9c0d2283c1300b5f4cf46832ad243fb98f5fc357dd893de349170af2fc43540422c7b229fdb3f16c68e68
|
|
7
|
+
data.tar.gz: b90aa376adf4f41d82ba86d8d22a03d04b447385ac0232029f12a0bc41b665405ea02051def0b4959bcd05ec33c0fc9021445756d7fc72ed71fae76efe623df7
|
|
@@ -25,6 +25,22 @@ module L43
|
|
|
25
25
|
raise ArgumentError, "cannot update attribute #{attribute.inspect} without a block" unless blk
|
|
26
26
|
update(attribute => blk.(to_h[attribute]))
|
|
27
27
|
end
|
|
28
|
+
|
|
29
|
+
def update_attribute_if(attribute, condition, &blk)
|
|
30
|
+
if condition
|
|
31
|
+
update(attribute => blk.(self))
|
|
32
|
+
else
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def update_attribute_unless(attribute, condition, &blk)
|
|
38
|
+
if condition
|
|
39
|
+
self
|
|
40
|
+
else
|
|
41
|
+
update(attribute => blk.(self))
|
|
42
|
+
end
|
|
43
|
+
end
|
|
28
44
|
end
|
|
29
45
|
end
|
|
30
46
|
end
|
data/lib/l43/open_object.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: l43_open_object
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Dober
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-03-
|
|
10
|
+
date: 2026-03-26 00:00:00.000000000 Z
|
|
11
11
|
dependencies: []
|
|
12
12
|
description: |-
|
|
13
13
|
When using the class method `attributes` in a class you get:
|
|
@@ -37,14 +37,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
37
37
|
requirements:
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
40
|
+
version: 4.0.1
|
|
41
41
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
requirements:
|
|
43
43
|
- - ">="
|
|
44
44
|
- !ruby/object:Gem::Version
|
|
45
45
|
version: '0'
|
|
46
46
|
requirements: []
|
|
47
|
-
rubygems_version: 4.0.
|
|
47
|
+
rubygems_version: 4.0.9
|
|
48
48
|
specification_version: 4
|
|
49
49
|
summary: Define attributes with potential defaults, get all the goodies...
|
|
50
50
|
test_files: []
|