Module: Wick
- Defined in:
- lib/wick.rb,
lib/wick/io.rb,
lib/wick/bus.rb,
lib/wick/stream.rb
Defined Under Namespace
Modules: IO
Classes: Bus, Stream
Constant Summary
collapse
- START =
Object.new.freeze
Class Method Summary
collapse
Class Method Details
.from_array(array) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/wick.rb', line 8
def from_array(array)
s = Stream.new
on_next_tick do
array.each do |item|
s << item
end
end
s
end
|
.on_next_tick(&callback) ⇒ Object
25
26
27
28
|
# File 'lib/wick.rb', line 25
def on_next_tick(&callback)
@tick_callbacks ||= []
@tick_callbacks.push(callback)
end
|
.run_loop!(&block) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/wick.rb', line 18
def run_loop!(&block)
while true
tick!
block.call()
end
end
|