Class: Sourced::CommandContext
- Inherits:
-
Object
- Object
- Sourced::CommandContext
- Defined in:
- lib/sourced/command_context.rb
Overview
Instance Method Summary collapse
- #build(attrs) ⇒ Sourced::Message
-
#initialize(stream_id: nil, metadata: Plumb::BLANK_HASH, scope: Sourced::Command) ⇒ CommandContext
constructor
A new instance of CommandContext.
Constructor Details
#initialize(stream_id: nil, metadata: Plumb::BLANK_HASH, scope: Sourced::Command) ⇒ CommandContext
Returns a new instance of CommandContext.
27 28 29 30 31 32 33 |
# File 'lib/sourced/command_context.rb', line 27 def initialize(stream_id: nil, metadata: Plumb::BLANK_HASH, scope: Sourced::Command) @defaults = { stream_id:, metadata: }.freeze @scope = scope end |
Instance Method Details
#build(attrs) ⇒ Sourced::Message
37 38 39 40 |
# File 'lib/sourced/command_context.rb', line 37 def build(attrs) attrs = defaults.merge(Types::SymbolizedHash.parse(attrs)) scope.from(attrs) end |