Class: SuperPoller::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/super_poller/handler.rb

Direct Known Subclasses

BufferedHandler

Defined Under Namespace

Classes: TestCase

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handles(*new_message_names) ⇒ Object



5
6
7
# File 'lib/super_poller/handler.rb', line 5

def handles(*new_message_names)
  @message_names = (message_names + new_message_names).uniq
end

.message_namesObject



9
10
11
# File 'lib/super_poller/handler.rb', line 9

def message_names
  @message_names || []
end

Instance Method Details

#call(message) ⇒ Object

Raises:

  • (NotImplementedError)


18
19
20
# File 'lib/super_poller/handler.rb', line 18

def call(message)
  raise NotImplementedError, "You must define a call handler."
end

#can_handle?(message) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/super_poller/handler.rb', line 14

def can_handle?(message)
  self.class.message_names.include? message[:name].to_sym
end