Class: Pgchief::Command::UserDrop
- Defined in:
- lib/pgchief/command/user_drop.rb
Overview
Class to drop a user
Instance Attribute Summary collapse
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Pgchief::Command::Base
Instance Attribute Details
#username ⇒ Object (readonly)
Returns the value of attribute username.
7 8 9 |
# File 'lib/pgchief/command/user_drop.rb', line 7 def username @username end |
Instance Method Details
#call ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/pgchief/command/user_drop.rb', line 9 def call @username = params.first raise Pgchief::Errors::UserExistsError unless user_exists? revoke_all_privileges drop_user "User '#{username}' dropped successfully!" rescue PG::Error => e "Error: #{e.}" ensure conn.close end |