Class: Listen::Event::Queue
- Inherits:
-
Object
- Object
- Listen::Event::Queue
- Extended by:
- Forwardable
- Defined in:
- lib/listen/event/queue.rb
Defined Under Namespace
Classes: Config
Instance Method Summary collapse
- #<<(args) ⇒ Object
-
#initialize(config) ⇒ Queue
constructor
A new instance of Queue.
Constructor Details
#initialize(config) ⇒ Queue
Returns a new instance of Queue.
22 23 24 25 |
# File 'lib/listen/event/queue.rb', line 22 def initialize(config) @event_queue = ::Queue.new @config = config end |
Instance Method Details
#<<(args) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/listen/event/queue.rb', line 27 def <<(args) type, change, dir, path, = *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 = if @config.relative? _safe_relative_from_cwd(dir) else dir end @event_queue << [type, change, dir, path, ] end |