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

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

Overview

This class is abstract.

Subclass and override #call to implement custom attribute method definition

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

Since:

  • 0.1.0

Direct Known Subclasses

Accessor, AggregateAccessor

Instance Method Summary collapse

Constructor Details

#initialize(attribute_data) ⇒ Base

Initializes a new attribute method definer

Parameters:

  • attribute_data (Object)

    Object containing attribute configuration

Options Hash (attribute_data):

  • :name (Symbol)

    The attribute 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/attribute/base.rb', line 19

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

Instance Method Details

#callvoid

This method is abstract.

This method returns an undefined value.

Defines the attribute-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/attribute/base.rb', line 29

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