Sha256: 3a6ec672bba7b4a6c5d4fbf348e0b1e382418b097a944e86b3c3b388dc799d5f

Contents?: true

Size: 336 Bytes

Versions: 3

Compression:

Stored size: 336 Bytes

Contents

module Controll
  class Event::Matcher
    attr_reader :event

    def initialize event
      @event = normalize event
    end

    def match? events
      normalized(events).include? event.name
    end

    protected

    include Controll::Event::Helper

    def normalized events
      [events].flatten.map(&:to_sym)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
controll-0.3.2 lib/controll/event/matcher.rb
controll-0.3.1 lib/controll/event/matcher.rb
controll-0.3.0 lib/controll/event/matcher.rb