Class: Garage::TokenScope::Scope
- Inherits:
-
Object
- Object
- Garage::TokenScope::Scope
- Defined in:
- lib/garage/token_scope.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Instance Method Summary collapse
- #access(action, klass) ⇒ Object
- #accessible_resources ⇒ Object
- #hidden? ⇒ Boolean
-
#initialize(sym, options = {}) ⇒ Scope
constructor
A new instance of Scope.
- #name ⇒ Object (also: #to_s)
- #optional? ⇒ Boolean
- #to_sym ⇒ Object
Constructor Details
#initialize(sym, options = {}) ⇒ Scope
Returns a new instance of Scope.
101 102 103 104 105 106 |
# File 'lib/garage/token_scope.rb', line 101 def initialize(sym, ={}) @sym = sym @access = [] @hidden = [:hidden] @description = [:desc] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
99 100 101 |
# File 'lib/garage/token_scope.rb', line 99 def description @description end |
Instance Method Details
#access(action, klass) ⇒ Object
113 114 115 |
# File 'lib/garage/token_scope.rb', line 113 def access(action, klass) @access << [klass.to_s, action] end |
#accessible_resources ⇒ Object
117 118 119 |
# File 'lib/garage/token_scope.rb', line 117 def accessible_resources @access end |
#hidden? ⇒ Boolean
125 126 127 |
# File 'lib/garage/token_scope.rb', line 125 def hidden? !!@hidden end |
#name ⇒ Object Also known as: to_s
108 109 110 |
# File 'lib/garage/token_scope.rb', line 108 def name @sym.to_s end |
#optional? ⇒ Boolean
129 130 131 |
# File 'lib/garage/token_scope.rb', line 129 def optional? @sym != :public && !hidden? end |
#to_sym ⇒ Object
121 122 123 |
# File 'lib/garage/token_scope.rb', line 121 def to_sym @sym end |