Class: Lyra::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/lyra/command.rb

Overview

Base command class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model_class, data = {}) ⇒ Command

Returns a new instance of Command.



6
7
8
9
# File 'lib/lyra/command.rb', line 6

def initialize(model_class, data = {})
  @model_class = model_class
  @data = data
end

Instance Attribute Details

#data ⇒ Object (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/lyra/command.rb', line 4

def data
  @data
end

#model_class ⇒ Object (readonly)

Returns the value of attribute model_class.



4
5
6
# File 'lib/lyra/command.rb', line 4

def model_class
  @model_class
end

Instance Method Details

#aggregate_id ⇒ Object



11
12
13
# File 'lib/lyra/command.rb', line 11

def aggregate_id
  data[:id] || data['id']
end