Class: TwoPercent::Domain::Events::BaseEvent

Inherits:
AetherObservatory::EventBase
  • Object
show all
Defined in:
lib/two_percent/domain/events/base_event.rb

Overview

Base class for domain events These are domain-focused, not SCIM-specific

Instance Method Summary collapse

Instance Method Details

#apply_to_model(model_class) ⇒ ActiveRecord::Base?

This method is abstract.

Override in subclasses to implement event-specific logic

Apply this event to a domain model class

Events know how to apply themselves to domain models, implementing the “tell, don’t ask” principle and avoiding case statements.

Parameters:

  • model_class (Class)

    The domain model class including Syncable

Returns:

  • (ActiveRecord::Base, nil)

    The affected record, if any

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/two_percent/domain/events/base_event.rb', line 21

def apply_to_model(model_class)
  raise NotImplementedError, "#{self.class} must implement #apply_to_model"
end