Sha256: d67f1277c4334a66c236df1b91c5c26c4520aa0684340f83b161ffee778d0a5d

Contents?: true

Size: 448 Bytes

Versions: 6

Compression:

Stored size: 448 Bytes

Contents

module Chicanery
  module Handlers
    %w{run started succeeded failed broken fixed commit}.each do |status|
      class_eval <<-EOF
        def when_#{status} &block
          #{status}_handlers << block
        end

        def #{status}_handlers
          @#{status}_handlers ||= []
        end

        def notify_#{status}_handlers *args
          #{status}_handlers.each {|handler| handler.call *args }
        end
      EOF
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
chicanery-0.1.0 lib/chicanery/handlers.rb
chicanery-0.0.9 lib/chicanery/handlers.rb
chicanery-0.0.8 lib/chicanery/handlers.rb
chicanery-0.0.7 lib/chicanery/handlers.rb
chicanery-0.0.6 lib/chicanery/handlers.rb
chicanery-0.0.5 lib/chicanery/handlers.rb