abstract class Bus::Handler

Defined in:

bus/handler.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(bus : Bus | Nil = nil, tags : Array(String) = [] of String, force : Bool | Nil = nil) #

[View source]

Instance Method Detail

def authorized_to_handle?(msg) #

Override this if only certain users should be authorized to have access to the given handler.


[View source]
def bus : Bus | Nil #

[View source]
def can_handle?(msg) #

This should probably be overridden in subclasses so that they can make informed decisions about whether or not they can handle the message.


[View source]
def evaluate(msg : Bus::Message) #

All implementations of


[View source]
def evaluated_count #

Return the number of times that this handler has evaluated a message.


[View source]
abstract def handle(msg : Bus::Message) #

[View source]
def handled_count #

Return the number of times that this handler has handled a message.


[View source]
def listen #

[View source]
def run #

[View source]
def subscribe(bus : Bus) #

[View source]
def will_handle?(msg) #

This method determines if the handler will handle the message. It checks #can_handle? to see if the handler is able to handle the message, and #authorized_to_handle? to see if the handler has permission to handle the message.


[View source]