Class: GithubPages::Handler

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

Class Method Summary collapse

Class Method Details

.def_handler(sym) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/ghpages_deploy/handler.rb', line 6

def self.def_handler(sym)
  define_method(:"on_#{sym}") do |*args, &block|
    handlers[sym].map { |handle| handle.call(*args, &block) }
  end

  define_method(:"handle_#{sym}") do |&block|
    handlers[sym] << block
    nil
  end
end