class GithubPages::Handler

Public Class Methods

def_handler(sym) click to toggle source
# 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

Private Instance Methods

handlers() click to toggle source
# File lib/ghpages_deploy/handler.rb, line 22
def handlers
  @handlers ||= Hash.new { |h, k| h[k] = [] }
end