Class: Wampproto::Message::Abort

Inherits:
Base
  • Object
show all
Defined in:
lib/wampproto/message/abort.rb

Overview

abort message

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

type, #type

Constructor Details

#initialize(details, reason, *args, **kwargs) ⇒ Abort

Returns a new instance of Abort.



9
10
11
12
13
14
15
# File 'lib/wampproto/message/abort.rb', line 9

def initialize(details, reason, *args, **kwargs)
  super()
  @details = Validate.hash!("Details", details)
  @reason = Validate.string!("Reason", reason)
  @args   = Validate.array!("Arguments", args)
  @kwargs = Validate.hash!("Keyword Arguments", kwargs)
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



7
8
9
# File 'lib/wampproto/message/abort.rb', line 7

def args
  @args
end

#detailsObject (readonly)

Returns the value of attribute details.



7
8
9
# File 'lib/wampproto/message/abort.rb', line 7

def details
  @details
end

#kwargsObject (readonly)

Returns the value of attribute kwargs.



7
8
9
# File 'lib/wampproto/message/abort.rb', line 7

def kwargs
  @kwargs
end

#reasonObject (readonly)

Returns the value of attribute reason.



7
8
9
# File 'lib/wampproto/message/abort.rb', line 7

def reason
  @reason
end

Class Method Details

.parse(wamp_message) ⇒ Object



24
25
26
27
28
29
# File 'lib/wampproto/message/abort.rb', line 24

def self.parse(wamp_message)
  _type, details, reason, args, kwargs = wamp_message
  args   ||= []
  kwargs ||= {}
  new(details, reason, *args, **kwargs)
end

Instance Method Details

#marshalObject



17
18
19
20
21
22
# File 'lib/wampproto/message/abort.rb', line 17

def marshal
  @marshal = [Type::ABORT, details, reason]
  @marshal << args if kwargs.any? || args.any?
  @marshal << kwargs if kwargs.any?
  @marshal
end