Class: Perm::Authorized
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Perm::Authorized
- Defined in:
- lib/perm/authorized.rb
Instance Attribute Summary collapse
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
-
#initialize(subject) ⇒ Authorized
constructor
A new instance of Authorized.
- #method_missing(name, *args) ⇒ Object
- #respond_to?(name) ⇒ Boolean
-
#user ⇒ Object
deprecated
Deprecated.
Please use #subject instead
Constructor Details
#initialize(subject) ⇒ Authorized
Returns a new instance of Authorized.
7 8 9 10 |
# File 'lib/perm/authorized.rb', line 7 def initialize(subject) raise ArgumentError.new("subject cannot be nil") if subject.nil? super @subject = subject end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
18 19 20 21 |
# File 'lib/perm/authorized.rb', line 18 def method_missing(name, *args) return false if can_method?(name) super end |
Instance Attribute Details
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
5 6 7 |
# File 'lib/perm/authorized.rb', line 5 def subject @subject end |
Instance Method Details
#respond_to?(name) ⇒ Boolean
23 24 25 26 |
# File 'lib/perm/authorized.rb', line 23 def respond_to?(name) return true if can_method?(name) super end |
#user ⇒ Object
Deprecated.
Please use #subject instead
13 14 15 16 |
# File 'lib/perm/authorized.rb', line 13 def user warn "The #user method has been deprecated in favor of #subject" subject end |