Sha256: d7a953d99ae3cff91a21c67a49c96b8bd5b888e80a34439fc88850d3e7f4d175

Contents?: true

Size: 1.2 KB

Versions: 3

Compression:

Stored size: 1.2 KB

Contents

module StateMachine
  module Integrations #:nodoc:
    module DataMapper
      version '0.9.x' do
        def self.active?
          ::DataMapper::VERSION =~ /^0\.9\./
        end
        
        def action_hook
          action
        end
      end
      
      version '0.9.x - 0.10.x' do
        def self.active?
          ::DataMapper::VERSION =~ /^0\.\d\./ || ::DataMapper::VERSION =~ /^0\.10\./
        end
        
        def pluralize(word)
          ::Extlib::Inflection.pluralize(word.to_s)
        end
      end
      
      version '0.9.4 - 0.9.6' do
        def self.active?
          ::DataMapper::VERSION =~ /^0\.9\.[4-6]/
        end
        
        # 0.9.4 - 0.9.6 fails to run after callbacks when validations are
        # enabled because of the way dm-validations integrates
        def define_action_helpers?
          super if action != :save || !supports_validations?
        end
      end
      
      version '1.0.0' do
        def self.active?
          ::DataMapper::VERSION == '1.0.0'
        end
        
        def pluralize(word)
          (defined?(::ActiveSupport::Inflector) ? ::ActiveSupport::Inflector : ::Extlib::Inflection).pluralize(word.to_s)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
state_machine-1.1.2 lib/state_machine/integrations/data_mapper/versions.rb
state_machine-1.1.1 lib/state_machine/integrations/data_mapper/versions.rb
state_machine-1.1.0 lib/state_machine/integrations/data_mapper/versions.rb