Sha256: d83c3dc45bc9e08c7bd717eb7439acc153df4150eee07853db456fcc7b3553e3

Contents?: true

Size: 670 Bytes

Versions: 7

Compression:

Stored size: 670 Bytes

Contents

module CanTango
  class Ability
    module EngineHelpers
      def execute_engines!
        each_engine do |engine|
          engine_rules = engine.new(self).execute! if engine
          @rules << engine_rules if !engine_rules.blank?
        end
      end

      def each_engine &block
        engines.execution_order.each do |name|
          yield engines.registered[name] if engines.active? name
        end
      end

      def opts_engines_off?
        options[:engines] == :off
      end

       def engines_on?
        CanTango.config.engines.any?(:on) && !opts_engines_off?
      end

      def engines
        CanTango.config.engines
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cantango-0.9.4.7 lib/cantango/ability/engine_helpers.rb
cantango-0.9.4.6 lib/cantango/ability/engine_helpers.rb
cantango-0.9.4.5 lib/cantango/ability/engine_helpers.rb
cantango-0.9.4.3 lib/cantango/ability/engine_helpers.rb
cantango-0.9.4.2 lib/cantango/ability/engine_helpers.rb
cantango-0.9.4.1 lib/cantango/ability/engine_helpers.rb
cantango-0.9.4 lib/cantango/ability/engine_helpers.rb