Class: Gexp::Command
- Inherits:
-
Object
- Object
- Gexp::Command
- Extended by:
- StateMachine::MacroMethods
- Defined in:
- lib/gexp/command.rb,
lib/gexp/command/stack.rb,
lib/gexp/command/object.rb
Overview
,Базовый класс комманд
Direct Known Subclasses
Defined Under Namespace
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#event ⇒ Object
TODO: only getter.
-
#object ⇒ Object
Returns the value of attribute object.
-
#params ⇒ Object
Returns the value of attribute params.
-
#provider ⇒ Object
Returns the value of attribute provider.
-
#subject ⇒ Object
Returns the value of attribute subject.
Instance Method Summary collapse
-
#hash ⇒ String
индетификатор комманды.
-
#initialize(params = {}) ⇒ Command
constructor
A new instance of Command.
-
#perform ⇒ Object
Заглушка для исполнения команды.
Constructor Details
#initialize(params = {}) ⇒ Command
Returns a new instance of Command.
39 40 41 42 43 44 |
# File 'lib/gexp/command.rb', line 39 def initialize(params = {}) @params = params.dup @errors = [] super() # Инициализация StateMachine end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
12 13 14 |
# File 'lib/gexp/command.rb', line 12 def context @context end |
#errors ⇒ Object
Returns the value of attribute errors.
11 12 13 |
# File 'lib/gexp/command.rb', line 11 def errors @errors end |
#event ⇒ Object
TODO: only getter
15 16 17 |
# File 'lib/gexp/command.rb', line 15 def event @event end |
#object ⇒ Object
Returns the value of attribute object.
17 18 19 |
# File 'lib/gexp/command.rb', line 17 def object @object end |
#params ⇒ Object
Returns the value of attribute params.
13 14 15 |
# File 'lib/gexp/command.rb', line 13 def params @params end |
#provider ⇒ Object
Returns the value of attribute provider.
19 20 21 |
# File 'lib/gexp/command.rb', line 19 def provider @provider end |
#subject ⇒ Object
Returns the value of attribute subject.
18 19 20 |
# File 'lib/gexp/command.rb', line 18 def subject @subject end |
Instance Method Details
#hash ⇒ String
индетификатор комманды
49 50 51 52 53 54 55 56 |
# File 'lib/gexp/command.rb', line 49 def hash # TODO: Заменить на BSON:ObjectId [ @params[:timestamp], @params[:event], @params[:seed], ].join('_') end |
#perform ⇒ Object
Заглушка для исполнения команды
61 62 63 64 65 66 67 |
# File 'lib/gexp/command.rb', line 61 def perform self.activate! self.failure! raise NotImplementedError.new \ 'Not defined perform method' end |