Class: SassListen::Event::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/sass-listen/event/config.rb

Instance Method Summary collapse

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/sass-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/sass-listen/event/config.rb', line 22

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

#callable?Boolean

Returns:

  • (Boolean)

34
35
36
# File 'lib/sass-listen/event/config.rb', line 34

def callable?
  @block
end

#event_queueObject


30
31
32
# File 'lib/sass-listen/event/config.rb', line 30

def event_queue
  @event_queue
end

#min_delay_between_eventsObject


42
43
44
# File 'lib/sass-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/sass-listen/event/config.rb', line 38

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

#paused?Boolean

Returns:

  • (Boolean)

50
51
52
# File 'lib/sass-listen/event/config.rb', line 50

def paused?
  listener.state == :paused
end

#sleep(*args) ⇒ Object


18
19
20
# File 'lib/sass-listen/event/config.rb', line 18

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

#stopped?Boolean

Returns:

  • (Boolean)

46
47
48
# File 'lib/sass-listen/event/config.rb', line 46

def stopped?
  listener.state == :stopped
end

#timestampObject


26
27
28
# File 'lib/sass-listen/event/config.rb', line 26

def timestamp
  Time.now.to_f
end