Module: ActiveInteraction::Transactable::ClassMethods

Defined in:
lib/active_interaction/concerns/transactable.rb

Overview

rubocop:disable Documentation

Since:

  • 1.2.0

Instance Method Summary collapse

Instance Method Details

#inherited(klass) ⇒ Object

Parameters:

  • klass (Class)

Since:

  • 1.2.0



43
44
45
46
47
# File 'lib/active_interaction/concerns/transactable.rb', line 43

def inherited(klass)
  klass.transaction(transaction?, transaction_options.dup)

  super
end

#transaction(enable, options = {}) ⇒ nil

Parameters:

  • enable (Boolean)
  • options (Hash) (defaults to: {})

Returns:

  • (nil)

Since:

  • 1.2.0



53
54
55
56
57
58
# File 'lib/active_interaction/concerns/transactable.rb', line 53

def transaction(enable, options = {})
  @_interaction_transaction_enabled = enable
  @_interaction_transaction_options = options

  nil
end

#transaction?Boolean

Returns:

  • (Boolean)

Since:

  • 1.2.0



61
62
63
64
65
66
67
# File 'lib/active_interaction/concerns/transactable.rb', line 61

def transaction?
  unless defined?(@_interaction_transaction_enabled)
    @_interaction_transaction_enabled = true
  end

  @_interaction_transaction_enabled
end

#transaction_optionsHash

Returns:

Since:

  • 1.2.0



70
71
72
73
74
75
76
# File 'lib/active_interaction/concerns/transactable.rb', line 70

def transaction_options
  unless defined?(@_interaction_transaction_options)
    @_interaction_transaction_options = {}
  end

  @_interaction_transaction_options
end