module StateMachines::Integrations::Base::ClassMethods

Attributes

defaults[R]

The default options to use for state machines using this integration

Public Instance Methods

integration_name() click to toggle source

The name of the integration

# File lib/state_machines/integrations/base.rb, line 10
def integration_name
  @integration_name ||= begin
    name = self.name.split('::').last
    name.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
    name.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
    name.downcase!
    name.to_sym
  end
end
matches?(klass) click to toggle source

Whether the integration should be used for the given class.

# File lib/state_machines/integrations/base.rb, line 26
def matches?(klass)
  matches_ancestors?(klass.ancestors.map { |ancestor| ancestor.name })
end
matches_ancestors?(ancestors) click to toggle source

Whether the integration should be used for the given list of ancestors.

# File lib/state_machines/integrations/base.rb, line 31
def matches_ancestors?(ancestors)
  (ancestors & matching_ancestors).any?
end
matching_ancestors() click to toggle source

The list of ancestor names that cause this integration to matched.

# File lib/state_machines/integrations/base.rb, line 21
def matching_ancestors
  []
end