Class: CouchDB::Security::UsersAndRolesProxy
- Inherits:
-
Object
- Object
- CouchDB::Security::UsersAndRolesProxy
- Defined in:
- lib/couchdb/security.rb
Overview
Proxy to manipulate an array structure of users and roles.
Instance Attribute Summary collapse
-
#names ⇒ Object
readonly
Returns the value of attribute names.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
Instance Method Summary collapse
- #<<(user_or_role) ⇒ Object
- #clear! ⇒ Object
-
#initialize(hash) ⇒ UsersAndRolesProxy
constructor
A new instance of UsersAndRolesProxy.
Constructor Details
#initialize(hash) ⇒ UsersAndRolesProxy
Returns a new instance of UsersAndRolesProxy.
37 38 39 40 41 |
# File 'lib/couchdb/security.rb', line 37 def initialize(hash) @hash = hash @names = @hash["names"] = [ ] @roles = @hash["roles"] = [ ] end |
Instance Attribute Details
#names ⇒ Object (readonly)
Returns the value of attribute names.
34 35 36 |
# File 'lib/couchdb/security.rb', line 34 def names @names end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
35 36 37 |
# File 'lib/couchdb/security.rb', line 35 def roles @roles end |
Instance Method Details
#<<(user_or_role) ⇒ Object
48 49 50 51 |
# File 'lib/couchdb/security.rb', line 48 def <<(user_or_role) @names << user_or_role.name if user_or_role.is_a?(CouchDB::User) @roles << user_or_role if user_or_role.is_a?(String) end |
#clear! ⇒ Object
43 44 45 46 |
# File 'lib/couchdb/security.rb', line 43 def clear! @names.clear @roles.clear end |