Class: Nayati::MasterWorkflow

Inherits:
Object
  • Object
show all
Defined in:
app/models/nayati/master_workflow.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#nameObject (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_namesObject



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_messageObject



44
45
46
# File 'app/models/nayati/master_workflow.rb', line 44

def error_message
  @errors.join(', ')
end

#exists?Boolean

Returns:

  • (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_messageObject



48
49
50
# File 'app/models/nayati/master_workflow.rb', line 48

def operation_addition_error_message
  @operation_addition_errors.join(', ')
end

#operation_namesObject



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

Returns:

  • (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

Returns:

  • (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