Class: Pgchief::Prompt::UserManagement

Inherits:
Base
  • Object
show all
Defined in:
lib/pgchief/prompt/user_management.rb

Overview

Class to manage users

Instance Attribute Summary

Attributes inherited from Base

#params

Instance Method Summary collapse

Methods inherited from Base

call, #initialize, #klassify, #prompt, #yes_or_no

Constructor Details

This class inherits a constructor from Pgchief::Prompt::Base

Instance Method Details

#callObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pgchief/prompt/user_management.rb', line 7

def call
  result = prompt.select('User management', [
                           'Create user',
                           'Drop user',
                           'User list',
                           'Grant database privileges',
                           'View database connection string'
                         ])

  scope = result == 'User list' ? 'command' : 'prompt'
  klassify(scope, result).call
end