Sha256: af2b918dd1a34c312a0fddb20bc2fa5ffc191bfb6348993dba8d1f9618b00000

Contents?: true

Size: 746 Bytes

Versions: 5

Compression:

Stored size: 746 Bytes

Contents

module CanTango::Ability
  module Helper
    module Masquerade
      def masquerading?
        candidate.respond_to?(:masquerading?) && candidate.masquerading?
      end
      alias_method :masquerade?, :masquerading?

      def masquerade_user?
        candidate.respond_to?(:active_user) && masquerading?
      end

      def masquerade_account?
        candidate.respond_to?(:active_account) && masquerading?
      end

      def masquerading_off?
        options[:masquerade] == false
      end
      alias_method :masquerade_off?, :masquerading_off?
      
      def subject
        return candidate.active_user if masquerade_user?
        return candidate.active_account if masquerade_account?
        candidate
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cantango-masquerade-0.1.3.1 lib/cantango/masquerade/ability/helper/masquerade.rb
cantango-masquerade-0.1.3 lib/cantango/masquerade/ability/helper/masquerade.rb
cantango-masquerade-0.1.2.1 lib/cantango/masquerade/ability/helper/masquerade.rb
cantango-masquerade-0.1.2 lib/cantango/masquerade/ability/helper/masquerade.rb
cantango-masquerade-0.1.1 lib/cantango/masquerade/ability/helper/masquerade.rb