ApipieBindings::AbstractCredentials
Can keep username and passwords credentials and prompt for them when necessary @param [Hash] params @option params [String] :username when nil, user is prompted when the attribute is accessed @option params [String] :password when nil, user is prompted when the attribute is accessed @example use container with prompt
c = HammerCLIForeman::BasicCredentials.new() c.username > [Foreman] Username: admin => "admin"
@example use container with preset value
c = HammerCLIForeman::BasicCredentials.new(:username => 'admin') c.username => "admin"
# File lib/hammer_cli_foreman/credentials.rb, line 18 def initialize(params={}) @username = params[:username] @password = params[:password] end
# File lib/hammer_cli_foreman/credentials.rb, line 41 def clear super @username = nil @password = nil end
# File lib/hammer_cli_foreman/credentials.rb, line 37 def empty? !@username && !@password end
Get password. Prompt for it when not set. Password characters are replaced with asterisks on the screen. @return [String]
# File lib/hammer_cli_foreman/credentials.rb, line 32 def password @password ||= ask_user(_("[Foreman] Password for %s: ") % username, true) if HammerCLI.interactive? @password end
Generated with the Darkfish Rdoc Generator 2.