Class: Rcqrs::ConventionCommand

Inherits:
BaseCommand show all
Defined in:
lib/rcqrs/convention_command.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseCommand

#errormessages

Constructor Details

#initialize(attributes = {}) ⇒ ConventionCommand

Returns a new instance of ConventionCommand.



19
20
21
22
23
# File 'lib/rcqrs/convention_command.rb', line 19

def initialize(attributes = {})
  super
  attributes.shift
  @data = attributes
end

Instance Attribute Details

#aggregate_idObject (readonly)

Returns the value of attribute aggregate_id.



5
6
7
# File 'lib/rcqrs/convention_command.rb', line 5

def aggregate_id
  @aggregate_id
end

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/rcqrs/convention_command.rb', line 5

def data
  @data
end

Class Method Details

.aggregate(aggregate) ⇒ Object



13
14
15
16
17
# File 'lib/rcqrs/convention_command.rb', line 13

def self.aggregate aggregate
  define_method(:aggregate) do
    return aggregate
  end
end

.aggregate_id_attribute(name) ⇒ Object



7
8
9
10
11
# File 'lib/rcqrs/convention_command.rb', line 7

def self.aggregate_id_attribute name
  define_method(:aggregate_id) do
    instance_variable_get("@" + name.to_s)
  end
end

Instance Method Details

#==(other) ⇒ Object



25
26
27
# File 'lib/rcqrs/convention_command.rb', line 25

def == other
  other.class == self.class && other.aggregate_id == self.aggregate_id && other.data == self.data
end