foobara-util 1.0.1 → 1.0.2

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: 5a174eb2a495f75a94027741d239c7f5b3a3fa20cdf1bf051b2073495a5d0094
4
- data.tar.gz: 84dbc9eaeb498408dedb7bd2f73fdab5dd9173b37e8dd7387eacc810d2bc3207
3
+ metadata.gz: 8f2492a2c2bcf6ae3801d6117d831065dfa7797cc832988209d76c224fb0582b
4
+ data.tar.gz: a0d20bde313cab91ccc58c2ea0fe83416fadcd8db1d5cf155d88a21c97cafdc5
5
5
  SHA512:
6
- metadata.gz: 5db55ff06bf816b239f5c4d2b4656bb29dfb065c4bf334feffda90573247bcd67f61a3f41106aa14124dc5b6c2a572fecdf8ed1030b2ecee58cf7b3b45267483
7
- data.tar.gz: b2c59e7ca45bf763d694fbdb50ca8874877303f9e2ed28a7071d38a8fbd093a6bcf5f6ee31e58437e92f52d95ed65ecfe08f5f2a9543244808ea8c6a506db779
6
+ metadata.gz: f41b4a6db1749ea211819b2279e838334e9b367c6ebeba232aa5b247cab8ffa66fcdf020cc459a1708c520ac62224796b3a850786ccc7d27297bd29059af4b6d
7
+ data.tar.gz: 8eff1b615db6f938c7f04c11f15b9ad5bb7c77cff8d82a1aa9f32624b86b42ec06ccb7b46fd748ce4306798f8c7f297fb35edfa95ec684eb43f8fc89ca34cb29
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [1.0.2] - 2025-07-25
2
+
3
+ - Add .remove_arity_check to help with using lambdas in DSLs
4
+
1
5
  ## [1.0.1] - 2025-07-07
2
6
 
3
7
  - Add Util.start_with? for array comparisons
@@ -0,0 +1,25 @@
1
+ module Foobara
2
+ module Util
3
+ module_function
4
+
5
+ def remove_arity_check(lambda)
6
+ arity = lambda.arity
7
+
8
+ if arity == 0
9
+ proc { |*, **opts, &block| lambda.call(**opts, &block) }
10
+ else
11
+ proc do |*args, **opts, &block|
12
+ args = args[0...arity]
13
+
14
+ remaining = arity - args.size
15
+
16
+ if remaining > 0
17
+ args += [nil] * remaining
18
+ end
19
+
20
+ lambda.call(*args, **opts, &block)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
10
+ date: 2025-07-25 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  email:
13
13
  - azimux@gmail.com
@@ -28,6 +28,7 @@ files:
28
28
  - lib/foobara/util/hash.rb
29
29
  - lib/foobara/util/meta.rb
30
30
  - lib/foobara/util/module.rb
31
+ - lib/foobara/util/proc.rb
31
32
  - lib/foobara/util/require.rb
32
33
  - lib/foobara/util/string.rb
33
34
  - lib/foobara/util/structured.rb
@@ -55,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
56
  - !ruby/object:Gem::Version
56
57
  version: '0'
57
58
  requirements: []
58
- rubygems_version: 3.6.9
59
+ rubygems_version: 3.6.2
59
60
  specification_version: 4
60
61
  summary: Utility functions used across various Foobara projects
61
62
  test_files: []