Class: OneSecret::KeyResolution::Stdin

Inherits:
Object
  • Object
show all
Defined in:
lib/one_secret/key_resolution.rb

Instance Method Summary collapse

Constructor Details

#initialize(output = STDOUT, input = STDIN) ⇒ Stdin

Returns a new instance of Stdin.



36
37
38
39
# File 'lib/one_secret/key_resolution.rb', line 36

def initialize(output = STDOUT, input = STDIN)
  @output = output
  @input = input
end

Instance Method Details

#keyObject



41
42
43
44
45
46
# File 'lib/one_secret/key_resolution.rb', line 41

def key
  @output.print OneSecret.message("Please enter your secret key: ")
  key = @input.noecho(&:gets).chomp
  @output.puts
  key unless key.blank?
end