Class: RoadForest::Authorization::GrantBuilder
- Inherits:
-
Object
- Object
- RoadForest::Authorization::GrantBuilder
- Defined in:
- lib/roadforest/authorization.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
Instance Method Summary collapse
- #add(name, params = nil) ⇒ Object
-
#initialize(salt, cache) ⇒ GrantBuilder
constructor
A new instance of GrantBuilder.
Constructor Details
#initialize(salt, cache) ⇒ GrantBuilder
Returns a new instance of GrantBuilder.
9 10 11 12 13 |
# File 'lib/roadforest/authorization.rb', line 9 def initialize(salt, cache) @salt = salt @cache = cache @list = [] end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
14 15 16 |
# File 'lib/roadforest/authorization.rb', line 14 def list @list end |
Instance Method Details
#add(name, params = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/roadforest/authorization.rb', line 16 def add(name, params=nil) canonical = if params.nil? [@salt, name] else [@salt, name, params.keys.sort.map do |key| [key, params[key]] end] end @list << @cache[canonical] end |