Class EventHook
In: lib/more/facets/eventhook.rb
Parent: Exception

Event Hook

Exception-based Event Hooks provides an Event Hooks system designed on top of Ruby‘s built-in Exception system.

  def dothis2
    puts 'pre'
    hook :quitit
    puts 'post'
  end

  def tryit2
    begin
      puts "BEFORE"
      dothis2
      puts "AFTER"
    rescue EventHook
      event :quitit do
        puts "HERE"
      end
    end
  end

  tryit2

Methods

call   new  

Attributes

cc  [R] 
name  [R] 

Public Class methods

[Source]

# File lib/more/facets/eventhook.rb, line 71
  def initialize(name, cc)
    @name = name
    @cc = cc
  end

Public Instance methods

[Source]

# File lib/more/facets/eventhook.rb, line 75
  def call
    @cc.call
  end

[Validate]