Sha256: 855fd889f80ab8c20ea8ee3ab777ff45fc03ce57ce47d14f01c587e85359af25
Contents?: true
Size: 353 Bytes
Versions: 11
Compression:
Stored size: 353 Bytes
Contents
module Barista class Hooks def initialize @callbacks = Hash.new { |h,k| h[k] = [] } end def on(name, &blk) @callbacks[name.to_sym] << blk end def invoke(name, *args) @callbacks[name.to_sym].each do |callback| break if callback.call(*args) == false end nil end end end
Version data entries
11 entries across 11 versions & 1 rubygems