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, &block) ⇒ Queue
constructor
A new instance of Queue.
Constructor Details
#initialize(config, &block) ⇒ Queue
Returns a new instance of Queue.
20 21 22 23 24 |
# File 'lib/listen/event/queue.rb', line 20 def initialize(config, &block) @event_queue = ::Queue.new @block = block @config = config end |
Instance Method Details
#<<(args) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/listen/event/queue.rb', line 26 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 = _safe_relative_from_cwd(dir) event_queue.public_send(:<<, [type, change, dir, path, ]) block.call(args) if block end |