dispatio 1.2.0 → 1.2.1

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +3 -1
  4. data/lib/dispatio.rb +9 -5
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f40f67d97bc67210b29b6509feaf066a36ad196e2580926dd2190b0bdfc201f0
4
- data.tar.gz: 3412b4cddd334b45d1969270ba75a7670482b995a44663484693564aedfb3009
3
+ metadata.gz: 1291fe6d6ec352d090a78afae44e98656c14026566448a039065f7b58cd9cdf2
4
+ data.tar.gz: 4e70a7cfd9125425d432c70d5eeb3df8829163ce19496378db877b9e8e7edbd2
5
5
  SHA512:
6
- metadata.gz: 1bdd84b304a216c2010e4c5e07539f5896d242775bf3a4b7484dc31a6cb48eec808a3ecb3d4ffe119e3844af3a2c77b1e85b06ac81d508ad54b5d42a46a9c71d
7
- data.tar.gz: bcb954aedf93e66e4a04bc21f11c61f8ac771f98af92ba7ae2a28fc2ce137d11b2ef0602b2aeeb7d503b19be40d7575458edd88b6b81e0eb276f05f5faf61ebb
6
+ metadata.gz: '08a3866d4918d6124b60399e0657e3e307647635a0105c9ff2ed54cb679eee236854e7e68ef6bee18939997bf7700cbe50fec87120dbe022b9f6c314da57a81f'
7
+ data.tar.gz: eb83b8f0fb6a6609f44e0f21333645269617c55dd952d43e85c6ae3a6800b020db65d606d629f4efc97e4d770472204a7c81d4a5f7e8bba29fc58b52c9c098f8
data/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
  # dispatio GHANGELOG.md
3
3
 
4
4
 
5
+ ## dispatio 1.2.1 released 2026-09-13
6
+
7
+ * Accept implicit `_suffix`
8
+ * Fix suffix:
9
+
10
+
5
11
  ## dispatio 1.2.0 released 2026-09-13
6
12
 
7
13
  * Introduce prefix: or suffix:
data/README.md CHANGED
@@ -19,7 +19,9 @@ class MyClass
19
19
 
20
20
  def post(type, msg)
21
21
 
22
- (@ptable ||= Dispatio.make_table(self, suffix: '_post').call(type, msg)
22
+ (@ptable ||= Dispatio.make_table(self, '_post').call(type, msg)
23
+ # or, more explicitely
24
+ #(@ptable ||= Dispatio.make_table(self, suffix: '_post').call(type, msg)
23
25
  end
24
26
 
25
27
  protected
data/lib/dispatio.rb CHANGED
@@ -1,15 +1,17 @@
1
1
 
2
2
  module Dispatio
3
3
 
4
- VERSION = '1.2.0'.freeze
4
+ VERSION = '1.2.1'.freeze
5
5
 
6
6
  class << self
7
7
 
8
8
  def make_table(point, prefix_or_opts)
9
9
 
10
10
  opts =
11
- prefix_or_opts.is_a?(String) ? { prefix: prefix_or_opts } :
12
- prefix_or_opts
11
+ case poo = prefix_or_opts
12
+ when /\A_/ then { suffix: poo }
13
+ when String then { prefix: poo }
14
+ else poo; end
13
15
 
14
16
  fail(
15
17
  ArgumentError,
@@ -29,9 +31,11 @@ module Dispatio
29
31
  .methods
30
32
  .inject({}) { |h, m|
31
33
  if px = opts[:prefix]
32
- h[m.to_s[px.size..-1]] = point.method(m) if m.to_s.start_with?(px)
34
+ h[m.to_s[px.length..-1]] = point.method(m) \
35
+ if m.to_s.start_with?(px)
33
36
  else; sx = opts[:suffix]
34
- h[m.to_s[0, sx.size-2]] = point.method(m) if m.to_s.end_with?(sx)
37
+ h[m.to_s[0..-(sx.length + 1)]] = point.method(m) \
38
+ if m.to_s.end_with?(sx)
35
39
  end
36
40
  h }
37
41
  ).freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dispatio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Mettraux