Class: Driskell::Listen::Event::Config
- Inherits:
-
Object
- Object
- Driskell::Listen::Event::Config
- Defined in:
- lib/driskell-listen/event/config.rb
Instance Method Summary collapse
- #call(*args) ⇒ Object
- #callable? ⇒ Boolean
- #event_queue ⇒ Object
-
#initialize(listener, event_queue, queue_optimizer, wait_for_delay, &block) ⇒ Config
constructor
A new instance of Config.
- #min_delay_between_events ⇒ Object
- #optimize_changes(changes) ⇒ Object
- #paused? ⇒ Boolean
- #sleep(*args) ⇒ Object
- #stopped? ⇒ Boolean
- #timestamp ⇒ Object
Constructor Details
#initialize(listener, event_queue, queue_optimizer, wait_for_delay, &block) ⇒ Config
Returns a new instance of Config.
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/driskell-listen/event/config.rb', line 4 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 Method Details
#call(*args) ⇒ Object
22 23 24 |
# File 'lib/driskell-listen/event/config.rb', line 22 def call(*args) @block.call(*args) if @block end |
#callable? ⇒ Boolean
34 35 36 |
# File 'lib/driskell-listen/event/config.rb', line 34 def callable? @block end |
#event_queue ⇒ Object
30 31 32 |
# File 'lib/driskell-listen/event/config.rb', line 30 def event_queue @event_queue end |
#min_delay_between_events ⇒ Object
42 43 44 |
# File 'lib/driskell-listen/event/config.rb', line 42 def min_delay_between_events @min_delay_between_events end |
#optimize_changes(changes) ⇒ Object
38 39 40 |
# File 'lib/driskell-listen/event/config.rb', line 38 def optimize_changes(changes) @queue_optimizer.smoosh_changes(changes) end |
#paused? ⇒ Boolean
50 51 52 |
# File 'lib/driskell-listen/event/config.rb', line 50 def paused? listener.state == :paused end |
#sleep(*args) ⇒ Object
18 19 20 |
# File 'lib/driskell-listen/event/config.rb', line 18 def sleep(*args) Kernel.sleep(*args) end |
#stopped? ⇒ Boolean
46 47 48 |
# File 'lib/driskell-listen/event/config.rb', line 46 def stopped? listener.state == :stopped end |
#timestamp ⇒ Object
26 27 28 |
# File 'lib/driskell-listen/event/config.rb', line 26 def Time.now.to_f end |