Class: Mastodon::Streaming::MessageParser

Inherits:
Object
  • Object
show all
Defined in:
lib/mastodon/streaming/message_parser.rb

Constant Summary collapse

MESSAGE_TYPES =
{
  'update' => Status,
  'notification' => Notification,
  'conversation' => Conversation,
  'delete' => Events::StatusDelete,
  'filters_changed' => Events::FiltersChange,
}.freeze

Class Method Summary collapse

Class Method Details

.parse(type, data) ⇒ Object



17
18
19
20
# File 'lib/mastodon/streaming/message_parser.rb', line 17

def self.parse(type, data)
  klass = MESSAGE_TYPES[type]
  klass.new(data) if klass
end