Sha256: fad372ccf46cc4c4256f1b1c68a04c2fe1142a16fa12ccaa120529d2cd14856a

Contents?: true

Size: 1015 Bytes

Versions: 23

Compression:

Stored size: 1015 Bytes

Contents

module Listen
  module Event
    class Config
      def initialize(
        listener,
        event_queue,
        queue_optimizer,
        wait_for_delay,
        &block)

        @listener = listener
        @event_queue = event_queue
        @queue_optimizer = queue_optimizer
        @min_delay_between_events = wait_for_delay
        @block = block
      end

      def sleep(*args)
        Kernel.sleep(*args)
      end

      def call(*args)
        @block.call(*args) if @block
      end

      def timestamp
        Time.now.to_f
      end

      def event_queue
        @event_queue
      end

      def callable?
        @block
      end

      def optimize_changes(changes)
        @queue_optimizer.smoosh_changes(changes)
      end

      def min_delay_between_events
        @min_delay_between_events
      end

      def stopped?
        listener.state == :stopped
      end

      def paused?
        listener.state == :paused
      end

      private

      attr_reader :listener
    end
  end
end

Version data entries

23 entries across 23 versions & 8 rubygems

Version Path
listen-3.0.2 lib/listen/event/config.rb
listen-3.0.1 lib/listen/event/config.rb
listen-3.0.0 lib/listen/event/config.rb