Class: Karafka::Web::Pro::Commanding::Commands::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/web/pro/commanding/commands/base.rb

Overview

Base for all the commands

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ Base

Returns a new instance of Base.

Parameters:

  • command (Command)

    command details (if any). Some commands may require extra details to work. They can be obtained from here.

[View source]

23
24
25
# File 'lib/karafka/web/pro/commanding/commands/base.rb', line 23

def initialize(command)
  @command = command
end

Class Attribute Details

.nameObject

Returns the value of attribute name.


15
16
17
# File 'lib/karafka/web/pro/commanding/commands/base.rb', line 15

def name
  @name
end

Instance Attribute Details

#commandHash (readonly)

Returns:

  • (Hash)

19
20
21
# File 'lib/karafka/web/pro/commanding/commands/base.rb', line 19

def command
  @command
end

Instance Method Details

#callObject

Executes the command after receiving it.

Raises:

  • (NotImlementedError)
[View source]

28
29
30
# File 'lib/karafka/web/pro/commanding/commands/base.rb', line 28

def call
  raise NotImlementedError, 'Please implement in a subclass'
end