Class: Csvtool::Interface::CLI::Prompts::FilePathPrompt

Inherits:
Object
  • Object
show all
Defined in:
lib/csvtool/interface/cli/prompts/file_path_prompt.rb

Constant Summary collapse

DEFAULT_LABEL =
"CSV file path: "

Instance Method Summary collapse

Constructor Details

#initialize(stdin:, stdout:) ⇒ FilePathPrompt

Returns a new instance of FilePathPrompt.



10
11
12
13
# File 'lib/csvtool/interface/cli/prompts/file_path_prompt.rb', line 10

def initialize(stdin:, stdout:)
  @stdin = stdin
  @stdout = stdout
end

Instance Method Details

#call(label: DEFAULT_LABEL) ⇒ Object



15
16
17
18
# File 'lib/csvtool/interface/cli/prompts/file_path_prompt.rb', line 15

def call(label: DEFAULT_LABEL)
  @stdout.print label
  @stdin.gets&.strip.to_s
end