Sha256: 1ba85ca7a279ba0107fdf927f56ff330038ec7c8564b29da32280f1ae814063e

Contents?: true

Size: 537 Bytes

Versions: 10

Compression:

Stored size: 537 Bytes

Contents

module CanTango
  class Engine
    include CanTango::Helpers::Debug

    attr_reader :ability, :options

    delegate :session, :user, :subject, :candidate, :cached?, :to => :ability

    def initialize ability, options = {}
      @ability, @options = [ability, options]
    end

    def execute!
      raise NotImplementedError
    end

    def engine_name
      raise NotImplementedError
    end

    def valid_mode? mode
      modes.include? mode.to_sym
    end

    def modes
      @modes ||= options[:modes] || []
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cantango-core-0.1.9.3 lib/cantango/engine.rb
cantango-core-0.1.9.2 lib/cantango/engine.rb
cantango-core-0.1.9.1 lib/cantango/engine.rb
cantango-core-0.1.9 lib/cantango/engine.rb
cantango-core-0.1.8 lib/cantango/engine.rb
cantango-core-0.1.7 lib/cantango/engine.rb
cantango-core-0.1.6 lib/cantango/engine.rb
cantango-core-0.1.5 lib/cantango/engine.rb
cantango-core-0.1.4 lib/cantango/engine.rb
cantango-core-0.1.3 lib/cantango/engine.rb