class Perm::Authorized

Attributes

subject[R]

Public Class Methods

new(subject) click to toggle source
Calls superclass method
# File lib/perm/authorized.rb, line 7
def initialize(subject)
  raise ArgumentError.new("subject cannot be nil") if subject.nil?
  super @subject = subject
end

Public Instance Methods

method_missing(name, *args) click to toggle source
Calls superclass method
# File lib/perm/authorized.rb, line 18
def method_missing(name, *args)
  return false if can_method?(name)
  super
end
respond_to?(name) click to toggle source
Calls superclass method
# File lib/perm/authorized.rb, line 23
def respond_to?(name)
  return true if can_method?(name)
  super
end
user() click to toggle source

@deprecated Please use subject instead

# File lib/perm/authorized.rb, line 13
def user
  warn "The #user method has been deprecated in favor of #subject"
  subject
end

Protected Instance Methods

can_method?(name) click to toggle source
# File lib/perm/authorized.rb, line 30
def can_method?(name)
  !!(name.to_s =~ /\Acan_.+\?\z/)
end