module Messaging::StreamName

Constants

Error

Public Class Methods

category?(stream_name) click to toggle source
# File lib/messaging/stream_name.rb, line 62
def self.category?(stream_name)
  MessageStore::StreamName.category?(stream_name)
end
get_cardinal_id(stream_name) click to toggle source
# File lib/messaging/stream_name.rb, line 78
def self.get_cardinal_id(stream_name)
  MessageStore::StreamName.get_cardinal_id(stream_name)
end
get_category(stream_name) click to toggle source
# File lib/messaging/stream_name.rb, line 58
def self.get_category(stream_name)
  MessageStore::StreamName.get_category(stream_name)
end
get_entity_name(stream_name) click to toggle source
# File lib/messaging/stream_name.rb, line 66
def self.get_entity_name(stream_name)
  MessageStore::StreamName.get_entity_name(stream_name)
end
get_id(stream_name) click to toggle source
# File lib/messaging/stream_name.rb, line 70
def self.get_id(stream_name)
  MessageStore::StreamName.get_id(stream_name)
end
get_ids(stream_name) click to toggle source
# File lib/messaging/stream_name.rb, line 74
def self.get_ids(stream_name)
  MessageStore::StreamName.get_ids(stream_name)
end
get_type(stream_name) click to toggle source
# File lib/messaging/stream_name.rb, line 82
def self.get_type(stream_name)
  MessageStore::StreamName.get_type(stream_name)
end
get_types(stream_name) click to toggle source
# File lib/messaging/stream_name.rb, line 86
def self.get_types(stream_name)
  MessageStore::StreamName.get_types(stream_name)
end
included(cls) click to toggle source
# File lib/messaging/stream_name.rb, line 7
def self.included(cls)
  cls.class_exec do
    include Virtual
    include Messaging::Category

    virtual :category
  end
end

Public Instance Methods

category_stream_name(category=nil, type: nil, types: nil) click to toggle source
# File lib/messaging/stream_name.rb, line 33
def category_stream_name(category=nil, type: nil, types: nil)
  category ||= self.category
  MessageStore::StreamName.stream_name(category, type: type, types: types)
end
command_category_stream_name(category=nil, type: nil, types: nil) click to toggle source
# File lib/messaging/stream_name.rb, line 50
def command_category_stream_name(category=nil, type: nil, types: nil)
  category ||= self.category
  types ||= []
  types.unshift('command')
  types << type unless type == nil
  MessageStore::StreamName.stream_name(category, types: types)
end
command_stream_name(id, category=nil, type: nil, types: nil) click to toggle source
# File lib/messaging/stream_name.rb, line 38
def command_stream_name(id, category=nil, type: nil, types: nil)
  if id == nil
    raise Error, "ID must not be omitted from command stream name"
  end

  category ||= self.category
  types ||= []
  types.unshift('command')
  types << type unless type == nil
  MessageStore::StreamName.stream_name(category, id, types: types)
end
stream_name(stream_id=nil, stream_category=nil, category: nil, cardinal_id: nil, id: nil, ids: nil, type: nil, types: nil) click to toggle source
# File lib/messaging/stream_name.rb, line 16
def stream_name(stream_id=nil, stream_category=nil, category: nil, cardinal_id: nil, id: nil, ids: nil, type: nil, types: nil)
  if stream_id.nil? && cardinal_id.nil? && id.nil? && ids.nil?
    raise Error, "ID must not be omitted from stream name"
  end

  stream_category ||= category
  if stream_category.nil?
    if not self.respond_to?(:category)
      raise Error, "Category must not be omitted from stream name"
    else
      stream_category = self.category
    end
  end

  MessageStore::StreamName.stream_name(stream_category, stream_id, cardinal_id: cardinal_id, id: id, ids: ids, type: type, types: types)
end