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.



48
49
50
# File 'lib/karafka/web/pro/commanding/commands/base.rb', line 48

def initialize(command)
  @command = command
end

Class Attribute Details

.nameObject

Returns the value of attribute name.



40
41
42
# File 'lib/karafka/web/pro/commanding/commands/base.rb', line 40

def name
  @name
end

Instance Attribute Details

#commandHash (readonly)

Returns:

  • (Hash)


44
45
46
# File 'lib/karafka/web/pro/commanding/commands/base.rb', line 44

def command
  @command
end

Instance Method Details

#callObject

Executes the command after receiving it.

Raises:

  • (NotImlementedError)


53
54
55
# File 'lib/karafka/web/pro/commanding/commands/base.rb', line 53

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