class FunWith::Passwords::Console
Attributes
pre_inputs[RW]
Public Class Methods
new()
click to toggle source
# File lib/fun_with/passwords/console.rb, line 6 def initialize @pre_inputs = [] end
Public Instance Methods
ask_for_asterisks( msg )
click to toggle source
# File lib/fun_with/passwords/console.rb, line 28 def ask_for_asterisks( msg ) ask( msg ){ |q| q.echo = "*" } end
ask_for_master_key( file )
click to toggle source
# File lib/fun_with/passwords/console.rb, line 16 def ask_for_master_key( file ) ask_for_asterisks( "Enter the master key to unlock #{file}: " ) end
ask_for_new_master_key( file )
click to toggle source
# File lib/fun_with/passwords/console.rb, line 20 def ask_for_new_master_key( file ) ask_for_asterisks( "Enter the NEW master key for #{file}: " ) end
ask_for_password( key = nil )
click to toggle source
# File lib/fun_with/passwords/console.rb, line 10 def ask_for_password( key = nil ) key ||= ask( "Enter the key associated with the password: ") pass = ask_for_asterisks( "Enter the password for key #{key}: " ) [key, pass] end
confirm( q )
click to toggle source
# File lib/fun_with/passwords/console.rb, line 24 def confirm( q ) ask( "#{q} (Y/N)").upcase == "Y" end
Protected Instance Methods
ask( *args, &block )
click to toggle source
# File lib/fun_with/passwords/console.rb, line 33 def ask( *args, &block ) if @pre_inputs.fwf_blank? HighLine.ask( *args, &block ) else @pre_inputs.shift end end