Class: Gruf::Commander::Request
- Inherits:
-
Object
- Object
- Gruf::Commander::Request
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/gruf/commander/request.rb
Overview
Base request class
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
Instance Method Summary collapse
-
#initialize(command:) ⇒ Request
constructor
A new instance of Request.
-
#submit! ⇒ Object
Validate and submit the request.
Constructor Details
#initialize(command:) ⇒ Request
Returns a new instance of Request.
32 33 34 |
# File 'lib/gruf/commander/request.rb', line 32 def initialize(command:) @command = command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
27 28 29 |
# File 'lib/gruf/commander/request.rb', line 27 def command @command end |
Instance Method Details
#submit! ⇒ Object
Validate and submit the request
rubocop:disable Style/RaiseArgs
41 42 43 44 45 |
# File 'lib/gruf/commander/request.rb', line 41 def submit! raise InvalidRequest.new(self) unless valid? command.call(self) end |