Class: Nayati::MasterWorkflow
- Inherits:
-
Object
- Object
- Nayati::MasterWorkflow
- Defined in:
- app/models/nayati/master_workflow.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #add_operation(operation_name) ⇒ Object
- #error_message ⇒ Object
- #exists? ⇒ Boolean
-
#initialize(name) ⇒ MasterWorkflow
constructor
A new instance of MasterWorkflow.
- #operation_addition_error_message ⇒ Object
- #operation_names ⇒ Object
- #save! ⇒ Object
- #valid? ⇒ Boolean
- #valid_to_add_operation?(operation_name) ⇒ Boolean
Constructor Details
#initialize(name) ⇒ MasterWorkflow
Returns a new instance of MasterWorkflow.
4 5 6 7 8 9 |
# File 'app/models/nayati/master_workflow.rb', line 4 def initialize(name) @name = name @errors = [] @operation_addition_errors = [] @name_as_sym = @name.to_sym end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'app/models/nayati/master_workflow.rb', line 3 def name @name end |
Class Method Details
.all_workflow_names ⇒ Object
38 39 40 |
# File 'app/models/nayati/master_workflow.rb', line 38 def all_workflow_names Nayati::OperationConfiguration.workflow_names end |
Instance Method Details
#add_operation(operation_name) ⇒ Object
15 16 17 |
# File 'app/models/nayati/master_workflow.rb', line 15 def add_operation(operation_name) Nayati::OperationConfiguration.add_operation_unless_present(self.name, operation_name) end |
#error_message ⇒ Object
44 45 46 |
# File 'app/models/nayati/master_workflow.rb', line 44 def @errors.join(', ') end |
#exists? ⇒ Boolean
23 24 25 |
# File 'app/models/nayati/master_workflow.rb', line 23 def exists? Nayati::OperationConfiguration.workflow_names.include?(@name_as_sym) end |
#operation_addition_error_message ⇒ Object
48 49 50 |
# File 'app/models/nayati/master_workflow.rb', line 48 def @operation_addition_errors.join(', ') end |
#operation_names ⇒ Object
11 12 13 |
# File 'app/models/nayati/master_workflow.rb', line 11 def operation_names Nayati::OperationConfiguration.operation_names(self.name) end |
#save! ⇒ Object
19 20 21 |
# File 'app/models/nayati/master_workflow.rb', line 19 def save! Nayati::OperationConfiguration.add_workflow_unless_present(self.name) end |
#valid? ⇒ Boolean
27 28 29 30 |
# File 'app/models/nayati/master_workflow.rb', line 27 def valid? validate_name @errors.empty? end |
#valid_to_add_operation?(operation_name) ⇒ Boolean
32 33 34 35 |
# File 'app/models/nayati/master_workflow.rb', line 32 def valid_to_add_operation?(operation_name) validate_operation_uniqueness(operation_name) @operation_addition_errors.empty? end |