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 +4 -4
- data/lib/cable_room/room/port_management.rb +1 -1
- data/lib/cable_room/room/port_scoping.rb +10 -4
- data/lib/cable_room/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: dd7b86ca05c74f92261902e8842dbc4f2945e15e8f3f05848e376b6cdd7869a6
         | 
| 4 | 
            +
              data.tar.gz: 15389fd9a02ac2afe13161d0321ac8938521039db8b56e1d7c610a3a17d88d2e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 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 | 
            -
                       | 
| 29 | 
            -
             | 
| 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)
         | 
    
        data/lib/cable_room/version.rb
    CHANGED