Class: FaaStRuby::EventChannel
- Inherits:
-
Object
- Object
- FaaStRuby::EventChannel
- Defined in:
- lib/faastruby/server/event_channel.rb
Constant Summary collapse
- @@channels =
{}
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(channel) ⇒ EventChannel
constructor
A new instance of EventChannel.
- #subscribe(function_path) ⇒ Object
- #subscribers ⇒ Object
Constructor Details
#initialize(channel) ⇒ EventChannel
Returns a new instance of EventChannel.
8 9 10 11 |
# File 'lib/faastruby/server/event_channel.rb', line 8 def initialize(channel) @name = channel @@channels[channel] ||= [] end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/faastruby/server/event_channel.rb', line 7 def name @name end |
Class Method Details
.channels ⇒ Object
4 5 6 |
# File 'lib/faastruby/server/event_channel.rb', line 4 def self.channels @@channels end |
Instance Method Details
#subscribe(function_path) ⇒ Object
12 13 14 |
# File 'lib/faastruby/server/event_channel.rb', line 12 def subscribe(function_path) @@channels[@name] << function_path end |
#subscribers ⇒ Object
15 16 17 |
# File 'lib/faastruby/server/event_channel.rb', line 15 def subscribers @@channels[@name] || [] end |