Sha256: c4317c2589c669a948ab86fae4ef7b9cf7a82f103753bb397bffb8dd619ec879

Contents?: true

Size: 549 Bytes

Versions: 5

Compression:

Stored size: 549 Bytes

Contents

module StateMachina
  module ExtendedIntegration
    module ClassMethods
      # Extends a machine on a model where the machine is already defined
      def extend_machine(klass, machine_name = 'default')
        model_name = StateMachina::Util.normalized_klass_to_name(klass)

        yield(StateMachina::Registry.find_machine!(model_name, machine_name))
      end

      alias_method :extend_state_machine, :extend_machine
    end

    def self.included(model)
      model.extend(StateMachina::ExtendedIntegration::ClassMethods)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
state_machina-0.1.6 lib/state_machina/extended_integration.rb
state_machina-0.1.5 lib/state_machina/extended_integration.rb
state_machina-0.1.4 lib/state_machina/extended_integration.rb
state_machina-0.1.3 lib/state_machina/extended_integration.rb
state_machina-0.1.2 lib/state_machina/extended_integration.rb