Class: Kobako::Wire::Envelope::Request
- Inherits:
-
Data
- Object
- Data
- Kobako::Wire::Envelope::Request
- Defined in:
- lib/kobako/wire/envelope.rb
Overview
Request (SPEC.md Wire Codec → Request)
4-element msgpack array: [target, method, args, kwargs]. target is either a String (“Group::Member”) or a Handle. SPEC pins kwargs map keys to ext 0x00 Symbol (→ Wire Codec → Ext Types); 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
A new instance of Request.
Constructor Details
#initialize(target:, method:, args: [], kwargs: {}) ⇒ Request
Returns a new instance of Request.
55 56 57 58 59 60 61 62 63 64 |
# File 'lib/kobako/wire/envelope.rb', line 55 def initialize(target:, method:, args: [], kwargs: {}) unless target.is_a?(String) || target.is_a?(Handle) raise ArgumentError, "Request target must be String or 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
54 55 56 |
# File 'lib/kobako/wire/envelope.rb', line 54 def args @args end |
#kwargs ⇒ Object (readonly)
Returns the value of attribute kwargs
54 55 56 |
# File 'lib/kobako/wire/envelope.rb', line 54 def kwargs @kwargs end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name
54 55 56 |
# File 'lib/kobako/wire/envelope.rb', line 54 def method_name @method_name end |
#target ⇒ Object (readonly)
Returns the value of attribute target
54 55 56 |
# File 'lib/kobako/wire/envelope.rb', line 54 def target @target end |