Sha256: 6c7049a70161265d5ba4656c3d0eca623fa8341250eca731c8fc298d2f14891f

Contents?: true

Size: 628 Bytes

Versions: 1

Compression:

Stored size: 628 Bytes

Contents

module QED

  require 'qed/advice/events'
  require 'qed/advice/patterns'

  # = Advice
  #
  # This class tracks advice defined by demo scripts
  # and helpers. It is instantiated in Scope, so that
  # the advice methods will have access to the same
  # local binding and the scripts themselves.
  #
  class Advice

    attr :patterns

    attr :events

    def initialize
      @patterns = Patterns.new
      @events   = Events.new
    end

    def call(scope, type, *args)
      case type
      when :when
        @patterns.call(scope, *args)
      else
        @events.call(scope, type, *args)
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qed-2.2.0 lib/qed/advice.rb