Module: Comandor::ClassMethods

Defined in:
lib/comandor.rb

Overview

ClassName.perform

Instance Method Summary collapse

Instance Method Details

#inherited(child) ⇒ Object

Callback when inherited from Comandor class



18
19
20
21
# File 'lib/comandor.rb', line 18

def inherited(child)
  child.prepend(Comandor)
  child.extend(ClassMethods)
end

#perform(*args, &block) ⇒ Object



23
24
25
# File 'lib/comandor.rb', line 23

def perform(*args, &block)
  new.perform(*args, &block)
end

#transaction!(name) ⇒ Object

Add transaction layer

Parameters:

  • [String] (name)

    ActiveRecord::Base.transaction



29
30
31
# File 'lib/comandor.rb', line 29

def transaction!(name)
  class_eval { @transaction_klass, @transaction_method = name.split('.') }
end

#transaction_klassObject

Class variables accessor



34
35
36
# File 'lib/comandor.rb', line 34

def transaction_klass
  @transaction_klass
end

#transaction_methodObject



38
39
40
# File 'lib/comandor.rb', line 38

def transaction_method
  @transaction_method
end