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



32
33
34
35
# File 'lib/sequent/core/command.rb', line 32

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

Class Method Details

.inherited(subclass) ⇒ Object



37
38
39
# File 'lib/sequent/core/command.rb', line 37

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