Method: Celerity::Listener#add_listener

Defined in:
lib/celerity/listener.rb

#add_listener(type, &block) ⇒ Object

Add a listener block for one of the available types.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/celerity/listener.rb', line 27

def add_listener(type, &block)
  case type
  when :status
    @webclient.setStatusHandler(self)
  when :alert
    @webclient.setAlertHandler(self)
  when :attachment
    @webclient.setAttachmentHandler(self)
  when :web_window_event
    @webclient.addWebWindowListener(self)
  when :html_parser
    @webclient.setHTMLParserListener(self)
  when :incorrectness
    @webclient.setIncorrectnessListener(self)
  when :confirm
    @webclient.setConfirmHandler(self)
  when :prompt
    @webclient.setPromptHandler(self)
  else
    raise ArgumentError, "unknown listener type #{type.inspect}"
  end

  @procs[type] << block
end