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