Class: Pgchief::Command::DatabasePrivilegesGrant
- Defined in:
- lib/pgchief/command/database_privileges_grant.rb
Overview
Class to grant database privileges
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Attributes inherited from Base
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(*params) ⇒ DatabasePrivilegesGrant
constructor
A new instance of DatabasePrivilegesGrant.
Methods inherited from Base
Constructor Details
#initialize(*params) ⇒ DatabasePrivilegesGrant
Returns a new instance of DatabasePrivilegesGrant.
9 10 11 12 13 |
# File 'lib/pgchief/command/database_privileges_grant.rb', line 9 def initialize(*params) @username = params[0] @password = params[1] @databases = params[2] end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
7 8 9 |
# File 'lib/pgchief/command/database_privileges_grant.rb', line 7 def database @database end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
7 8 9 |
# File 'lib/pgchief/command/database_privileges_grant.rb', line 7 def password @password end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/pgchief/command/database_privileges_grant.rb', line 7 def username @username end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/pgchief/command/database_privileges_grant.rb', line 15 def call @databases.each do |database| @database = database grant_privs! store_credentials! end "Privileges granted to #{username} on #{@databases.join(', ')}" end |