Class: Racf::Commands::Listuser
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Racf::Commands::Listuser
- Defined in:
- lib/racf/commands/listuser.rb
Instance Method Summary collapse
- #extract_resources(arguments) ⇒ Object
-
#initialize(session) ⇒ Listuser
constructor
A new instance of Listuser.
- #run(*args) ⇒ Object
Constructor Details
#initialize(session) ⇒ Listuser
Returns a new instance of Listuser.
21 22 23 24 25 26 |
# File 'lib/racf/commands/listuser.rb', line 21 def initialize(session) @users = {} @current_user = {} super end |
Instance Method Details
#extract_resources(arguments) ⇒ Object
53 54 55 56 57 58 59 60 61 62 |
# File 'lib/racf/commands/listuser.rb', line 53 def extract_resources(arguments) resources = arguments.first case resources when String [resources] when Array resources end end |
#run(*args) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/racf/commands/listuser.rb', line 28 def run(*args) users_ids = extract_users_ids(args) command = "LISTUSER (#{users_ids})" raw_output = @session.run_command(command) @scanner = StringScanner.new(raw_output) log_number_of_users(@scanner.rest) @user_index = 1 while @scanner.scan(/(.*?)$\n/) case state_name when :nothing_processed, :user_processed process_name when :name_processed finish_user_parsing end end users = @users clear_state users end |