Module: WaveBox::ReceiveWave
- Defined in:
- lib/wave_box/receive_wave.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
3
4
5
6
7
8
9
10
11
|
# File 'lib/wave_box/receive_wave.rb', line 3
def method_missing(method, *args, &block)
if method.to_s =~ /received_(\w+)_after/
received_after( $1, *args )
elsif method.to_s =~ /receive_(\w+)/
receive( $1, *args)
else
super
end
end
|
Class Method Details
.included(host) ⇒ Object
68
69
70
|
# File 'lib/wave_box/receive_wave.rb', line 68
def self.included(host)
host.extend ClassMethods
end
|
Instance Method Details
#receive(name, wave, time = Time.now) ⇒ Object
13
14
15
|
# File 'lib/wave_box/receive_wave.rb', line 13
def receive(name, wave, time = Time.now)
send("#{name}_inbox").push(wave, time)
end
|
#received_after(name, time) ⇒ Object
17
18
19
|
# File 'lib/wave_box/receive_wave.rb', line 17
def received_after(name, time)
send("#{name}_inbox").after(time)
end
|