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.
6 7 8 9 |
# File 'lib/perm/authorized.rb', line 6 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
11 12 13 14 |
# File 'lib/perm/authorized.rb', line 11 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.
4 5 6 |
# File 'lib/perm/authorized.rb', line 4 def user @user end |
Instance Method Details
#respond_to?(name) ⇒ Boolean
16 17 18 19 |
# File 'lib/perm/authorized.rb', line 16 def respond_to?(name) return true if can_method?(name) super end |