l43_open_object 0.2.3 → 0.2.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
  SHA256:
3
- metadata.gz: 10bdaa5f61e9a0308915ebc819a135797dffd5e42c903387400422aed4250144
4
- data.tar.gz: 750a314d9770f6cacfde3ca3427332a4bd9ddf534bef2f3493c235a23f4addfa
3
+ metadata.gz: e1227726f23fd0f9b45d1e3077ddaeb2ed1385c78b5646df59a17c0f7096a9c8
4
+ data.tar.gz: 95647d6001f64f30a1cd942ecb3c12475c6d98aab9bf8e7cfe5316e3ffb16c2a
5
5
  SHA512:
6
- metadata.gz: 8e0fff087431d0d1104b97c7b6df5acd4c5335db87b9c0d2283c1300b5f4cf46832ad243fb98f5fc357dd893de349170af2fc43540422c7b229fdb3f16c68e68
7
- data.tar.gz: b90aa376adf4f41d82ba86d8d22a03d04b447385ac0232029f12a0bc41b665405ea02051def0b4959bcd05ec33c0fc9021445756d7fc72ed71fae76efe623df7
6
+ metadata.gz: 190e2cbde8e61f4e2cbd5848144e58777bf5eec867d8471b565d77b0ee4af2a787e3ea8e1d04a22022fc957a464d73c4c0aeb918480dbe257804ffabbde38797
7
+ data.tar.gz: 436fb3e39930fac9547a62addfdde953376ee1161e71045100c5190e092747089d2c3cfd518473ce9b20535f8c0df9a88901e6e611f76035dd5ca1aa905c49fc
@@ -21,14 +21,17 @@ module L43
21
21
  end
22
22
  end
23
23
 
24
- def update_attribute(attribute, &blk)
25
- raise ArgumentError, "cannot update attribute #{attribute.inspect} without a block" unless blk
26
- update(attribute => blk.(to_h[attribute]))
24
+ def update_attribute(attribute, value=nil, &blk)
25
+ if blk
26
+ update(attribute => blk.(to_h[attribute]))
27
+ else
28
+ update(attribute => value)
29
+ end
27
30
  end
28
31
 
29
32
  def update_attribute_if(attribute, condition, &blk)
30
33
  if condition
31
- update(attribute => blk.(self))
34
+ update_attribute(attribute, condition, &blk)
32
35
  else
33
36
  self
34
37
  end
@@ -4,7 +4,7 @@ require_relative 'open_object/initializer'
4
4
  require_relative 'open_object/behavior'
5
5
  module L43
6
6
  module OpenObject
7
- VERSION = "0.2.3"
7
+ VERSION = "0.2.4"
8
8
 
9
9
  def attributes(*atts, **defaults, &blk)
10
10
  attr_reader(*atts)
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.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-03-26 00:00:00.000000000 Z
10
+ date: 2026-03-28 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  description: |-
13
13
  When using the class method `attributes` in a class you get:
@@ -44,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
44
  - !ruby/object:Gem::Version
45
45
  version: '0'
46
46
  requirements: []
47
- rubygems_version: 4.0.9
47
+ rubygems_version: 4.0.3
48
48
  specification_version: 4
49
49
  summary: Define attributes with potential defaults, get all the goodies...
50
50
  test_files: []