Class: EventSource::Stream
- Inherits:
-
Object
- Object
- EventSource::Stream
- Defined in:
- lib/event_source/stream.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.canonize(stream) ⇒ Object
15 16 17 18 19 |
# File 'lib/event_source/stream.rb', line 15 def self.canonize(stream) return stream if stream.is_a? self new stream end |
.get_type(name) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/event_source/stream.rb', line 5 def self.get_type(name) subtype = name.split(':').last.split('-').first if name.start_with?(subtype) return :stream else return subtype.to_sym end end |
Instance Method Details
#==(stream) ⇒ Object
33 34 35 |
# File 'lib/event_source/stream.rb', line 33 def ==(stream) name == stream.name end |
#category ⇒ Object
25 26 27 |
# File 'lib/event_source/stream.rb', line 25 def category @category ||= StreamName.get_category(name) end |
#category? ⇒ Boolean
29 30 31 |
# File 'lib/event_source/stream.rb', line 29 def category? @is_category ||= !name.include?('-') end |
#type ⇒ Object
21 22 23 |
# File 'lib/event_source/stream.rb', line 21 def type @type ||= self.class.get_type(name) end |