Class: SplitIoClient::SSE::EventSource::StreamData
- Inherits:
-
Object
- Object
- SplitIoClient::SSE::EventSource::StreamData
- Defined in:
- lib/splitclient-rb/sse/event_source/stream_data.rb
Instance Attribute Summary collapse
-
#channel ⇒ Object
readonly
Returns the value of attribute channel.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#event_type ⇒ Object
readonly
Returns the value of attribute event_type.
Instance Method Summary collapse
-
#initialize(event_type, client_id, data, channel) ⇒ StreamData
constructor
A new instance of StreamData.
- #occupancy? ⇒ Boolean
Constructor Details
#initialize(event_type, client_id, data, channel) ⇒ StreamData
Returns a new instance of StreamData.
9 10 11 12 13 14 |
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 9 def initialize(event_type, client_id, data, channel) @event_type = event_type @client_id = client_id @data = data @channel = channel&.gsub(SplitIoClient::Constants::OCCUPANCY_CHANNEL_PREFIX, '') end |
Instance Attribute Details
#channel ⇒ Object (readonly)
Returns the value of attribute channel.
7 8 9 |
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 7 def channel @channel end |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
7 8 9 |
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 7 def client_id @client_id end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
7 8 9 |
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 7 def data @data end |
#event_type ⇒ Object (readonly)
Returns the value of attribute event_type.
7 8 9 |
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 7 def event_type @event_type end |
Instance Method Details
#occupancy? ⇒ Boolean
16 17 18 |
# File 'lib/splitclient-rb/sse/event_source/stream_data.rb', line 16 def occupancy? @channel.include? 'control' end |