Class: Natsukantou::Setup::WritePrompt
- Inherits:
-
Object
- Object
- Natsukantou::Setup::WritePrompt
- Defined in:
- lib/natsukantou/setup/write_prompt.rb
Instance Method Summary collapse
Instance Method Details
#execute(prompt:, content:, origin_path:, lang_to:) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/natsukantou/setup/write_prompt.rb', line 8 def execute(prompt:, content:, origin_path:, lang_to:) result_path = prompt.ask( 'Where do you want to save the result?', value: origin_path.pathmap("%X.#{lang_to}%x") ) File.write(result_path, content) rescue Errno::EISDIR warn 'Specified path is a directory.' retry end |