Class: Clandestine::IO
- Inherits:
-
Object
- Object
- Clandestine::IO
- Defined in:
- lib/clandestine/io.rb
Class Method Summary collapse
- .copy_to_clipboard(value) ⇒ Object
- .get_password(safe_password = false) ⇒ Object
- .print_keys(contents) ⇒ Object
Class Method Details
.copy_to_clipboard(value) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/clandestine/io.rb', line 5 def self.copy_to_clipboard(value) ::IO.popen('pbcopy', 'w') { |b| b.print "#{value}" } say("Password on clipboard countdown: ") 10.downto(1) do |n| sleep(1); n == 1 ? say("1") : say("#{n} ") end ::IO.popen('pbcopy', 'w') { |b| b.print "" } end |
.get_password(safe_password = false) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/clandestine/io.rb', line 22 def self.get_password(safe_password = false) = if safe_password "Enter the new safe password" else "Enter the safe password" end ask() { |q| q.echo = "*" } end |
.print_keys(contents) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/clandestine/io.rb', line 15 def self.print_keys(contents) puts "-------------" puts "Safe Contents" puts "-------------" contents.sort.each { |key| puts key.to_s } end |