Class: Async::Bus::Protocol::Invoke
- Inherits:
-
Object
- Object
- Async::Bus::Protocol::Invoke
- Defined in:
- lib/async/bus/protocol/invoke.rb
Overview
Represents a method invocation.
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#block_given ⇒ Object
readonly
Returns the value of attribute block_given.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
- #The positional arguments.(positionalarguments.) ⇒ Object readonly
- #The transaction ID.(transactionID.) ⇒ Object readonly
Class Method Summary collapse
-
.unpack(unpacker) ⇒ Object
Unpack an invocation from a MessagePack unpacker.
Instance Method Summary collapse
-
#initialize(id, name, arguments, options, block_given) ⇒ Invoke
constructor
Initialize a new invocation message.
-
#pack(packer) ⇒ Object
Pack the invocation into a MessagePack packer.
- #The keyword arguments.=(keywordarguments. = (value)) ⇒ Object
- #The method name.=(methodname. = (value)) ⇒ Object
- #Whether a block was provided.=(ablockwasprovided. = (value)) ⇒ Object
Constructor Details
#initialize(id, name, arguments, options, block_given) ⇒ Invoke
Initialize a new invocation message.
20 21 22 23 24 25 26 |
# File 'lib/async/bus/protocol/invoke.rb', line 20 def initialize(id, name, arguments, , block_given) @id = id @name = name @arguments = arguments = @block_given = block_given end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
35 36 37 |
# File 'lib/async/bus/protocol/invoke.rb', line 35 def arguments @arguments end |
#block_given ⇒ Object (readonly)
Returns the value of attribute block_given.
41 42 43 |
# File 'lib/async/bus/protocol/invoke.rb', line 41 def block_given @block_given end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
29 30 31 |
# File 'lib/async/bus/protocol/invoke.rb', line 29 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
32 33 34 |
# File 'lib/async/bus/protocol/invoke.rb', line 32 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
38 39 40 |
# File 'lib/async/bus/protocol/invoke.rb', line 38 def end |
#The positional arguments.(positionalarguments.) ⇒ Object (readonly)
35 |
# File 'lib/async/bus/protocol/invoke.rb', line 35 attr :arguments |
#The transaction ID.(transactionID.) ⇒ Object (readonly)
29 |
# File 'lib/async/bus/protocol/invoke.rb', line 29 attr :id |
Class Method Details
.unpack(unpacker) ⇒ Object
Unpack an invocation from a MessagePack unpacker.
66 67 68 69 70 71 72 73 74 |
# File 'lib/async/bus/protocol/invoke.rb', line 66 def self.unpack(unpacker) id = unpacker.read name = unpacker.read arguments = Array.new(unpacker.read){unpacker.read} = Array.new(unpacker.read){[unpacker.read, unpacker.read]}.to_h block_given = unpacker.read return self.new(id, name, arguments, , block_given) end |
Instance Method Details
#pack(packer) ⇒ Object
Pack the invocation into a MessagePack packer.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/async/bus/protocol/invoke.rb', line 45 def pack(packer) packer.write(@id) packer.write(@name) packer.write(@arguments.size) @arguments.each do |argument| packer.write(argument) end packer.write(.size) .each do |key, value| packer.write(key) packer.write(value) end packer.write(@block_given) end |
#The keyword arguments.=(keywordarguments. = (value)) ⇒ Object
38 |
# File 'lib/async/bus/protocol/invoke.rb', line 38 attr :options |
#The method name.=(methodname. = (value)) ⇒ Object
32 |
# File 'lib/async/bus/protocol/invoke.rb', line 32 attr :name |
#Whether a block was provided.=(ablockwasprovided. = (value)) ⇒ Object
41 |
# File 'lib/async/bus/protocol/invoke.rb', line 41 attr :block_given |