Class: Rasti::App::User
- Inherits:
-
Object
- Object
- Rasti::App::User
- Defined in:
- lib/rasti/app/user.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#permissions ⇒ Object
readonly
Returns the value of attribute permissions.
Instance Method Summary collapse
- #authorized?(permission) ⇒ Boolean
-
#initialize(attributes = {}) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(attributes = {}) ⇒ User
Returns a new instance of User.
7 8 9 10 |
# File 'lib/rasti/app/user.rb', line 7 def initialize(attributes={}) @name = attributes[:name] @permissions = attributes.fetch(:permissions, []) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/rasti/app/user.rb', line 5 def name @name end |
#permissions ⇒ Object (readonly)
Returns the value of attribute permissions.
5 6 7 |
# File 'lib/rasti/app/user.rb', line 5 def @permissions end |
Instance Method Details
#authorized?(permission) ⇒ Boolean
12 13 14 |
# File 'lib/rasti/app/user.rb', line 12 def () .any? { |p| Permission.new(p).include? } end |