Class: Ucasy::Flow

Inherits:
Base show all
Defined in:
lib/ucasy/flow.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

_required_attributes, call, #initialize, #perform, required_attributes, validate

Methods inherited from Callable

call

Constructor Details

This class inherits a constructor from Ucasy::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ucasy::Base

Class Method Details

.flow(*ucases) ⇒ Object



4
5
6
# File 'lib/ucasy/flow.rb', line 4

def flow(*ucases)
  @ucases = ucases
end

.transactionalObject



12
13
14
# File 'lib/ucasy/flow.rb', line 12

def transactional
  @transactional = true
end

.transactional?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/ucasy/flow.rb', line 16

def transactional?
  @transactional || false
end

.ucasesObject



8
9
10
# File 'lib/ucasy/flow.rb', line 8

def ucases
  @ucases || []
end

Instance Method Details

#callObject



21
22
23
24
25
26
27
28
29
# File 'lib/ucasy/flow.rb', line 21

def call
  if self.class.transactional?
    ActiveRecord::Base.transaction { execute }
  else
    execute
  end

  self
end