module Anyt::ConnectHandlers

Custom connect handlers management

Public Class Methods

add(tag, &block) click to toggle source
# File lib/anyt/ext/minitest.rb, line 50
def add(tag, &block)
  handlers << [tag, block]
end
call(connection) click to toggle source
# File lib/anyt/ext/minitest.rb, line 43
def call(connection)
  handlers_for(connection).each do |(_, handler)|
    connection.reject_unauthorized_connection unless
      connection.instance_eval(&handler)
  end
end

Private Class Methods

handlers() click to toggle source
# File lib/anyt/ext/minitest.rb, line 62
def handlers
  @handlers ||= []
end
handlers_for(connection) click to toggle source
# File lib/anyt/ext/minitest.rb, line 56
def handlers_for(connection)
  handlers.select do |(tag, _)|
    connection.params["test"] == tag
  end
end