Class: Wake::Script::Batch
- Inherits:
-
Object
- Object
- Wake::Script::Batch
- Defined in:
- lib/wake/script.rb
Instance Method Summary collapse
- #call(data, event, path) ⇒ Object
- #deliver ⇒ Object
-
#initialize(rule) ⇒ Batch
constructor
A new instance of Batch.
Constructor Details
#initialize(rule) ⇒ Batch
Returns a new instance of Batch.
23 24 25 26 27 |
# File 'lib/wake/script.rb', line 23 def initialize rule @timer = nil @rule = rule @events = [] end |
Instance Method Details
#call(data, event, path) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/wake/script.rb', line 29 def call data, event, path # $stderr.print "batch add #{data} #{event} #{path}\n" if @timer @timer.cancel end @timer = EM::Timer.new(0.001) do deliver Wake.batches.delete self end Wake.batches[self] = self # p data, event, path @events << [ data.to_a, event, path ] @events.uniq! # p @events end |