Class: InterstateMachine::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/interstate_machine/environment.rb

Class Method Summary collapse

Class Method Details

.active_record?(base) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/interstate_machine/environment.rb', line 12

def self.active_record?(base)
  base.ancestors.include?(ActiveRecord::Base) rescue false
end

.define(base) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/interstate_machine/environment.rb', line 4

def self.define(base)
  if active_record?(base)
    base.send(:include, ActiveRecordClass::InstanceMethods)
  else
    base.send(:prepend, PlainRuby::InstanceMethods)
  end
end