class OBS::WebSocket::Protocol::Event

Constants

CLASSES_BY_JSON_NAME

Public Class Methods

create(type, payload) click to toggle source
# File lib/obs/websocket.rb, line 367
def self.create(type, payload)
  cls = CLASSES_BY_JSON_NAME[type] || UnknownEvent
  cls.new(payload)
end
json_name(json_name) click to toggle source
# File lib/obs/websocket.rb, line 363
def self.json_name(json_name)
  CLASSES_BY_JSON_NAME[json_name] = self
end
new(json) click to toggle source
# File lib/obs/websocket.rb, line 372
def initialize(json)
  @json = json
end

Public Instance Methods

rec_timecode() click to toggle source
# File lib/obs/websocket.rb, line 390
def rec_timecode
  get_field('rec-timecode', Types::Optional[Types::String])
end
stream_timecode() click to toggle source
# File lib/obs/websocket.rb, line 387
def stream_timecode;
  get_field('stream-timecode', Types::Optional[Types::String])
end
to_h() click to toggle source
# File lib/obs/websocket.rb, line 380
def to_h
  @json
end
update_type() click to toggle source
# File lib/obs/websocket.rb, line 384
def update_type
  get_field('update-type', Types::String)
end

Private Instance Methods

get_field(name, type) click to toggle source
# File lib/obs/websocket.rb, line 376
        def get_field(name, type)
  type.as_ruby(@json[name])
end