Class: Kobako::RPC::Request
- Inherits:
-
Data
- Object
- Data
- Kobako::RPC::Request
- Defined in:
- lib/kobako/rpc/envelope.rb
Overview
Value object for a single guest-initiated RPC Request (SPEC.md Wire Codec → Request).
4-element msgpack array: [target, method, args, kwargs]. target is either a String (+“Namespace::Member”+) or a Handle. SPEC pins kwargs map keys to ext 0x00 Symbol; enforced at construction so the Value Object is the single source of truth.
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#kwargs ⇒ Object
readonly
Returns the value of attribute kwargs.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
-
#initialize(target:, method:, args: [], kwargs: {}) ⇒ Request
constructor
steep:ignore:start.
Constructor Details
#initialize(target:, method:, args: [], kwargs: {}) ⇒ Request
steep:ignore:start
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/kobako/rpc/envelope.rb', line 27 def initialize(target:, method:, args: [], kwargs: {}) unless target.is_a?(String) || target.is_a?(Kobako::RPC::Handle) raise ArgumentError, "Request target must be String or Kobako::RPC::Handle, got #{target.class}" end raise ArgumentError, "Request method must be String" unless method.is_a?(String) raise ArgumentError, "Request args must be Array" unless args.is_a?(Array) validate_kwargs!(kwargs) super(target: target, method_name: method, args: args, kwargs: kwargs) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args
25 26 27 |
# File 'lib/kobako/rpc/envelope.rb', line 25 def args @args end |
#kwargs ⇒ Object (readonly)
Returns the value of attribute kwargs
25 26 27 |
# File 'lib/kobako/rpc/envelope.rb', line 25 def kwargs @kwargs end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name
25 26 27 |
# File 'lib/kobako/rpc/envelope.rb', line 25 def method_name @method_name end |
#target ⇒ Object (readonly)
Returns the value of attribute target
25 26 27 |
# File 'lib/kobako/rpc/envelope.rb', line 25 def target @target end |