Class: Karafka::Web::Pro::Commanding::Request
- Inherits:
-
Object
- Object
- Karafka::Web::Pro::Commanding::Request
- Defined in:
- lib/karafka/web/pro/commanding/request.rb
Overview
Encapsulates the command request details not to use a raw hash
Instance Method Summary collapse
-
#[](key) ⇒ Object
Fetches the underlying details value and raises key error when not available.
-
#initialize(details) ⇒ Request
constructor
A new instance of Request.
-
#name ⇒ String
Name of the request.
-
#to_h ⇒ Hash
Raw details.
Constructor Details
#initialize(details) ⇒ Request
Returns a new instance of Request.
38 39 40 |
# File 'lib/karafka/web/pro/commanding/request.rb', line 38 def initialize(details) @details = details end |
Instance Method Details
#[](key) ⇒ Object
Fetches the underlying details value and raises key error when not available
52 53 54 |
# File 'lib/karafka/web/pro/commanding/request.rb', line 52 def [](key) @details.fetch(key) end |
#name ⇒ String
Returns name of the request.
43 44 45 |
# File 'lib/karafka/web/pro/commanding/request.rb', line 43 def name self[:name] end |
#to_h ⇒ Hash
Returns raw details.
57 58 59 |
# File 'lib/karafka/web/pro/commanding/request.rb', line 57 def to_h @details end |