Module: Stateful

Defined in:
lib/Stateful.rb,
lib/Stateful/Poro.rb,
lib/Stateful/State.rb,
lib/Stateful/States.rb,
lib/Stateful/VERSION.rb,
lib/Stateful/Transition.rb,
lib/Stateful/ActiveRecord.rb,
lib/Stateful/ClassMethods.rb,
lib/Stateful/InstanceMethods.rb,
lib/Stateful/Poro/ClassMethods.rb,
lib/Stateful/ActiveRecord/ClassMethods.rb

Overview

Stateful/ActiveRecord/ClassMethods.rb Stateful::ActiveRecord::ClassMethods

Defined Under Namespace

Modules: ActiveRecord, ClassMethods, InstanceMethods, Poro Classes: State, States, Transition

Constant Summary collapse

VERSION =
'0.14.11'

Class Method Summary collapse

Class Method Details

.extended(klass) ⇒ Object Also known as: included



8
9
10
11
12
13
14
15
16
# File 'lib/Stateful.rb', line 8

def extended(klass)
  if defined?(::ActiveRecord::Base) && klass < ::ActiveRecord::Base
    require_relative File.join('Stateful', 'ActiveRecord')
    klass.extend(Stateful::ActiveRecord)
  else
    require_relative File.join('Stateful', 'Poro')
    klass.extend(Stateful::Poro)
  end
end