Top Level Namespace
Defined Under Namespace
Modules: Wires
Classes: Time
Instance Method Summary
collapse
Instance Method Details
#Channel(*args) ⇒ Object
19
|
# File 'lib/wires/channel.rb', line 19
def Channel(*args) Wires::Channel.new(*args) end
|
#expect_type(x, type) ⇒ Object
2
3
4
5
6
|
# File 'lib/wires/expect_type.rb', line 2
def expect_type(x, type)
unless x.is_a? type
raise "Expected #{x.inspect} to be an instance of #{type}."
end
end
|
#fire(event, channel = '*') ⇒ Object
10
11
12
|
# File 'lib/wires/channel.rb', line 10
def fire(event, channel='*')
Wires::Channel.new(channel).fire(event, blocking:false)
nil end
|
#fire_and_wait(event, channel = '*') ⇒ Object
14
15
16
|
# File 'lib/wires/channel.rb', line 14
def fire_and_wait(event, channel='*')
Wires::Channel.new(channel).fire(event, blocking:true)
nil end
|
#on(events, channels = '*', &codeblock) ⇒ Object
2
3
4
5
6
7
|
# File 'lib/wires/channel.rb', line 2
def on(events, channels='*', &codeblock)
channels = [channels] unless channels.is_a? Array
for channel in channels
Wires::Channel.new(channel).register(events, codeblock)
end
nil end
|
#puts(x) ⇒ Object
Make sure puts goes to $stdout for all threads!
3
|
# File 'lib/wires/hub.rb', line 3
def puts(x) $stdout.puts(x) end
|