Class: Yes::Core::Aggregate::Dsl::MethodDefiners::Command::Base Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/yes/core/aggregate/dsl/method_definers/command/base.rb

Overview

This class is abstract.

Subclass and override #call to implement custom command method definition

Base class for command method definers that provides common functionality for defining command-related methods on aggregate classes.

Since:

  • 0.1.0

Direct Known Subclasses

CanCommand, Command

Instance Method Summary collapse

Constructor Details

#initialize(command_data) ⇒ Base

Initializes a new command method definer

Parameters:

  • command_data (Object)

    Object containing command configuration

Options Hash (command_data):

  • :name (Symbol)

    The command name

  • :aggregate_class (Class)

    The target aggregate class where methods will be defined

Since:

  • 0.1.0



19
20
21
22
# File 'lib/yes/core/aggregate/dsl/method_definers/command/base.rb', line 19

def initialize(command_data)
  @name = command_data.name
  @aggregate_class = command_data.aggregate_class
end

Instance Method Details

#callvoid

This method is abstract.

This method returns an undefined value.

Defines the command-related methods on the aggregate class

Raises:

  • (NotImplementedError)

    when called on the base class

Since:

  • 0.1.0



29
30
31
# File 'lib/yes/core/aggregate/dsl/method_definers/command/base.rb', line 29

def call
  raise NotImplementedError, "#{self.class} must implement #call"
end