Class: Sequent::Core::BaseCommand

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations, ActiveModel::Validations::Callbacks, Helpers::AttributeSupport, Helpers::Copyable, Helpers::EqualSupport, Helpers::Mergable, Helpers::ParamSupport, Helpers::TypeConversionSupport, Helpers::UuidHelper
Defined in:
lib/sequent/core/command.rb

Overview

Base class for all Command’s.

Commands form the API of your domain. They are simple data objects with descriptive names of what they want to achieve. E.g. ‘SendInvoice`.

BaseCommand uses ‘ActiveModel::Validations` for validations

Direct Known Subclasses

Command, SnapshotCommand

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Helpers::TypeConversionSupport

#parse_attrs_to_correct_types

Methods included from Helpers::Copyable

#copy

Methods included from Helpers::AttributeSupport

#as_json, #attributes, #ensure_known_attributes, included, #update, #validation_errors

Methods included from Helpers::UuidHelper

new_uuid

Methods included from Helpers::EqualSupport

#==, #eql?, #hash

Methods included from Helpers::ParamSupport

#as_params, #from_params, included, #to_params

Methods included from Helpers::Mergable

#merge!

Constructor Details

#initialize(args = {}) ⇒ BaseCommand

Returns a new instance of BaseCommand.



34
35
36
37
# File 'lib/sequent/core/command.rb', line 34

def initialize(args = {})
  update_all_attributes args
  @created_at = DateTime.now
end

Class Method Details

.inherited(subclass) ⇒ Object



39
40
41
42
# File 'lib/sequent/core/command.rb', line 39

def self.inherited(subclass)
  super
  Commands << subclass
end