Class: Listen::Event::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/listen-3.8.0/lib/listen/event/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(listener, event_queue, queue_optimizer, wait_for_delay, &block) ⇒ Config

Returns a new instance of Config.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/listen-3.8.0/lib/listen/event/config.rb', line 8

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

Instance Attribute Details

#event_queueObject (readonly)

Returns the value of attribute event_queue.



6
7
8
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/listen-3.8.0/lib/listen/event/config.rb', line 6

def event_queue
  @event_queue
end

#listenerObject (readonly)

Returns the value of attribute listener.



6
7
8
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/listen-3.8.0/lib/listen/event/config.rb', line 6

def listener
  @listener
end

#min_delay_between_eventsObject (readonly)

Returns the value of attribute min_delay_between_events.



6
7
8
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/listen-3.8.0/lib/listen/event/config.rb', line 6

def min_delay_between_events
  @min_delay_between_events
end

Instance Method Details

#call(*args) ⇒ Object



27
28
29
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/listen-3.8.0/lib/listen/event/config.rb', line 27

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

#callable?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/listen-3.8.0/lib/listen/event/config.rb', line 31

def callable?
  @block
end

#optimize_changes(changes) ⇒ Object



35
36
37
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/listen-3.8.0/lib/listen/event/config.rb', line 35

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

#sleep(seconds) ⇒ Object



23
24
25
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/listen-3.8.0/lib/listen/event/config.rb', line 23

def sleep(seconds)
  Kernel.sleep(seconds)
end