Module: EventSource::StreamName
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.get_category(stream_name) ⇒ Object
14 15 16 |
# File 'lib/event_source/stream_name.rb', line 14 def self.get_category(stream_name) stream_name.split('-')[0] end |
.get_id(stream_name) ⇒ Object
9 10 11 12 |
# File 'lib/event_source/stream_name.rb', line 9 def self.get_id(stream_name) id = stream_name.partition('-')[2] id.empty? ? nil : id end |
Instance Method Details
#stream_name(category_name, id) ⇒ Object
5 6 7 |
# File 'lib/event_source/stream_name.rb', line 5 def stream_name(category_name, id) "#{category_name}-#{id}" end |