Class: SassListen::Event::Queue

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

Defined Under Namespace

Classes: Config

Instance Method Summary collapse

Constructor Details

#initialize(config, &block) ⇒ Queue

Returns a new instance of Queue.


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

def initialize(config, &block)
  @event_queue = ::Queue.new
  @block = block
  @config = config
end

Instance Method Details

#<<(args) ⇒ Object


24
25
26
27
28
29
30
31
32
33
34
# File 'lib/sass-listen/event/queue.rb', line 24

def <<(args)
  type, change, dir, path, options = *args
  fail "Invalid type: #{type.inspect}" unless [:dir, :file].include? type
  fail "Invalid change: #{change.inspect}" unless change.is_a?(Symbol)
  fail "Invalid path: #{path.inspect}" unless path.is_a?(String)

  dir = _safe_relative_from_cwd(dir)
  event_queue.public_send(:<<, [type, change, dir, path, options])

  block.call(args) if block
end

#empty?Boolean

Returns:

  • (Boolean)

36
37
38
# File 'lib/sass-listen/event/queue.rb', line 36

def empty?
  event_queue.empty?
end

#popObject


40
41
42
# File 'lib/sass-listen/event/queue.rb', line 40

def pop
  event_queue.pop
end