Class: Wamp::Type::Invocation

Inherits:
Object
  • Object
show all
Defined in:
lib/wamp/type/invocation.rb

Overview

Invocation Type

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args: [], kwargs: {}, details: {}) ⇒ Invocation

Returns a new instance of Invocation.



10
11
12
13
14
# File 'lib/wamp/type/invocation.rb', line 10

def initialize(args: [], kwargs: {}, details: {})
  @args = args
  @kwargs = kwargs
  @details = details
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



8
9
10
# File 'lib/wamp/type/invocation.rb', line 8

def args
  @args
end

#connection=(value) ⇒ Object (writeonly)

Sets the attribute connection

Parameters:

  • value

    the value to set the attribute connection to.



7
8
9
# File 'lib/wamp/type/invocation.rb', line 7

def connection=(value)
  @connection = value
end

#detailsObject (readonly)

Returns the value of attribute details.



8
9
10
# File 'lib/wamp/type/invocation.rb', line 8

def details
  @details
end

#kwargsObject (readonly)

Returns the value of attribute kwargs.



8
9
10
# File 'lib/wamp/type/invocation.rb', line 8

def kwargs
  @kwargs
end

#request_id=(value) ⇒ Object (writeonly)

Sets the attribute request_id

Parameters:

  • value

    the value to set the attribute request_id to.



7
8
9
# File 'lib/wamp/type/invocation.rb', line 7

def request_id=(value)
  @request_id = value
end

Instance Method Details

#progress(result) ⇒ Object



16
17
18
# File 'lib/wamp/type/invocation.rb', line 16

def progress(result)
  @connection.transmit @connection.session.send_message(response(result))
end

#response(result) ⇒ Object



20
21
22
# File 'lib/wamp/type/invocation.rb', line 20

def response(result)
  Wampproto::Message::Yield.new(@request_id, result.details, *result.args, **result.kwargs)
end