Class: RComet::ChannelSet
- Inherits:
-
Object
- Object
- RComet::ChannelSet
- Defined in:
- lib/rcomet/channel.rb
Overview
:nodoc:
Instance Method Summary collapse
- #[](channel_or_path) ⇒ Object
- #[]=(channel_or_path, data) ⇒ Object
-
#initialize ⇒ ChannelSet
constructor
A new instance of ChannelSet.
Constructor Details
#initialize ⇒ ChannelSet
3 4 5 |
# File 'lib/rcomet/channel.rb', line 3 def initialize @channels = Hash.new end |
Instance Method Details
#[](channel_or_path) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rcomet/channel.rb', line 7 def [](channel_or_path) channel = nil if( channel_or_path.class == RComet::Channel ) return @channels[channel_or_path.path] if @channels.has_key?(channel_or_path.path) channel = channel_or_path else return @channels[channel_or_path] if @channels.has_key?(channel_or_path) channel = RComet::Channel.new( channel_or_path ) end @channels[channel.path] = channel return channel end |
#[]=(channel_or_path, data) ⇒ Object
21 22 23 24 25 |
# File 'lib/rcomet/channel.rb', line 21 def []=(channel_or_path, data) channel = self[channel_or_path] channel.data( data ) return channel end |