Class: DSP::Event

Inherits:
DSPBase show all
Defined in:
lib/dsp/dsp_protocol.rb

Overview

interface Event extends ProtocolMessage {

    /** Type of event. */
    event: string;
    /** Event-specific information. */
    body?: any;
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DSPBase

#to_h, #to_json

Constructor Details

#initialize(initial_hash = nil) ⇒ Event

Returns a new instance of Event.



64
65
66
67
# File 'lib/dsp/dsp_protocol.rb', line 64

def initialize(initial_hash = nil)
  super
  @optional_method_names = %i[body]
end

Instance Attribute Details

#bodyObject

type: string # type: any # type: number # type: string



62
63
64
# File 'lib/dsp/dsp_protocol.rb', line 62

def body
  @body
end

#eventObject

type: string # type: any # type: number # type: string



62
63
64
# File 'lib/dsp/dsp_protocol.rb', line 62

def event
  @event
end

#seqObject

type: string # type: any # type: number # type: string



62
63
64
# File 'lib/dsp/dsp_protocol.rb', line 62

def seq
  @seq
end

#typeObject

type: string # type: any # type: number # type: string



62
63
64
# File 'lib/dsp/dsp_protocol.rb', line 62

def type
  @type
end

Instance Method Details

#from_h!(value) ⇒ Object



69
70
71
72
73
74
75
76
# File 'lib/dsp/dsp_protocol.rb', line 69

def from_h!(value)
  value = {} if value.nil?
  self.event = value['event']
  self.body = value['body']
  self.seq = value['seq']
  self.type = value['type']
  self
end