Class: EventHook

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/event_hook.rb

Constant Summary collapse

VERSION =
'1.1.1'
NONE =
0x00
LINE =
0x01
CLASS =
0x02
NND =
0x04
CALL =
0x08
RETURN =
0x10
CCALL =
0x20
CRETURN =
0x40
RAISE =
0x80
ALL =
0xff
EVENTS =

Ruby events that EventHook notifies you about.

{
  LINE    => :line,
  CLASS   => :class,
  NND     => :end,
  CALL    => :call,
  RETURN  => :return,
  CCALL   => :ccall,
  CRETURN => :creturn,
  RAISE   => :raise,
}

Class Method Summary collapse

Class Method Details

.process(*args) ⇒ Object

Redefine me in a subclass. args is [event_id, self, method, class].

Raises:

  • (NotImplementedError)


45
46
47
# File 'lib/event_hook.rb', line 45

def self.process(*args)
  raise NotImplementedError, "subclass responsibility"
end

.start_hookObject



34
35
36
# File 'lib/event_hook.rb', line 34

def self.start_hook
  self.instance.add_event_hook
end

.stop_hookObject



38
39
40
# File 'lib/event_hook.rb', line 38

def self.stop_hook
  self.instance.remove_event_hook
end