Module: BigMachine::ClassMethods

Defined in:
lib/big_machine.rb

Instance Method Summary collapse

Instance Method Details

#active_record_model?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/big_machine.rb', line 21

def active_record_model?
  defined?(::ActiveRecord::Base) && self.ancestors.include?(::ActiveRecord::Base)
end

#big_machine(options) ⇒ Object



25
26
27
28
29
# File 'lib/big_machine.rb', line 25

def big_machine(options)
  self.initial_state   = options[:initial_state]
  self.workflow        = options[:workflow]
  set_initial_state_class
end

#initial_state_classObject



31
32
33
# File 'lib/big_machine.rb', line 31

def initial_state_class
  @initial_state_class
end

#set_initial_state_classObject



35
36
37
38
# File 'lib/big_machine.rb', line 35

def set_initial_state_class
  @initial_state_class = self.initial_state.to_s.camelize.constantize
  include ::BigMachine::AvailableMethods
end