Class: Cuprum::Errors::CommandNotImplemented

Inherits:
Cuprum::Error show all
Defined in:
lib/cuprum/errors/command_not_implemented.rb

Overview

Error class to be used when a Command is called without defining a #process method.

Constant Summary collapse

MESSAGE_FORMAT =

Format for generating error message.

'no implementation defined for %s'

Instance Attribute Summary collapse

Attributes inherited from Cuprum::Error

#message

Instance Method Summary collapse

Methods inherited from Cuprum::Error

#==

Constructor Details

#initialize(command:) ⇒ CommandNotImplemented

Returns a new instance of CommandNotImplemented.

Parameters:



17
18
19
20
21
22
23
24
# File 'lib/cuprum/errors/command_not_implemented.rb', line 17

def initialize(command:)
  @command = command

  class_name = command&.class&.name || 'command'
  message    = MESSAGE_FORMAT % class_name

  super(message: message)
end

Instance Attribute Details

#commandCuprum::Command (readonly)

Returns The command called without a definition.

Returns:



27
28
29
# File 'lib/cuprum/errors/command_not_implemented.rb', line 27

def command
  @command
end