cable_room 0.5.0 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e7c2fd48ac93d24a9ae68aae23aee05c3373d60154f54b0c7900e8863559fa89
4
- data.tar.gz: 48f564bb727ed8cfd5932d9a07d7ac6f24d969ce5622bf87f8ff5766f44b17e7
3
+ metadata.gz: dd7b86ca05c74f92261902e8842dbc4f2945e15e8f3f05848e376b6cdd7869a6
4
+ data.tar.gz: 15389fd9a02ac2afe13161d0321ac8938521039db8b56e1d7c610a3a17d88d2e
5
5
  SHA512:
6
- metadata.gz: b2bc85c458cf22927817827dd5d742f68060d0dee82b50338dfd27a9c78c5fe465afb8dc10e086c40c5e8171154542c9e6c1f39c9c72ab10b77199c85bba5cb0
7
- data.tar.gz: e7f45e327bee8df3ffb82ae510a805900cce03ad710a6ab2b1986b29d51adbaf4b118aa21be299f4f495267777cf37f26e14e6a043528554d9ce4a46092c73e8
6
+ metadata.gz: 2e619af9f847afff84afa5f60f37b90b825fc8e1151d7d93641a4cb16ff8bc79e092059f70b1df7d0943442b4d03e13d942eea39b2b61444cfd4a7b361055d95
7
+ data.tar.gz: 4e5be487299bba472b4d594409d2ee4d5b1c12dd1fb4b0eab67125d22ce338ad228ed7f0b06e1b236b21ed42b0c29fbc55e2a574b5746b9ccc223b8024c3c8a4
@@ -58,7 +58,7 @@ module CableRoom
58
58
  def _apply_port_scope(client_port: nil, tag: nil, **kwargs)
59
59
  if client_port && tag
60
60
  client_port = resolve_client_port(client_port)
61
- throw :abort unless client_port && client_port[:tags]&.include?(tag)
61
+ throw :abort unless client_port && client_port[:tags]&.include?(tag) || client_port[:as] == tag
62
62
  end
63
63
 
64
64
  { client_port: client_port || tag, **kwargs }
@@ -22,13 +22,19 @@ module CableRoom
22
22
  Room.current_port_scope = prev
23
23
  end
24
24
 
25
+ def simplify_port_scope(**kwargs)
26
+ catch :abort do
27
+ remaining = _apply_port_scope(**kwargs)
28
+ return remaining
29
+ end
30
+ nil
31
+ end
32
+
25
33
  # Similar to with_port_scope, but won't call the block if no ports match
26
34
  def with_port_scope!(**kwargs, &blk)
27
35
  if kwargs.empty?
28
- catch :abort do
29
- remaining = _apply_port_scope(**Room.current_port_scope || {})
30
- blk.call(**remaining)
31
- end
36
+ reduced_scope = simplify_port_scope(**Room.current_port_scope || {})
37
+ blk.call(**reduced_scope) unless reduced_scope.nil?
32
38
  else
33
39
  with_port_scope(**kwargs) do
34
40
  with_port_scope!(&blk)
@@ -1,3 +1,3 @@
1
1
  module CableRoom
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.5.1".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cable_room
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Knapp