Class: Dotenvious::Prompter
- Inherits:
-
Object
- Object
- Dotenvious::Prompter
- Defined in:
- lib/dotenvious/prompter.rb
Instance Method Summary collapse
-
#initialize(filename = DEFAULT_ENV_FILE) ⇒ Prompter
constructor
A new instance of Prompter.
- #run ⇒ Object
Constructor Details
#initialize(filename = DEFAULT_ENV_FILE) ⇒ Prompter
Returns a new instance of Prompter.
8 9 10 |
# File 'lib/dotenvious/prompter.rb', line 8 def initialize(filename = DEFAULT_ENV_FILE) @filename = filename end |
Instance Method Details
#run ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/dotenvious/prompter.rb', line 12 def run keys_in_question.each do |key, status| decision = prompt(key, status) return if decision == 'q' next unless decision.downcase == 'y' if status == 'missing' EnvAppender.new(filename).append(key) elsif status == 'mismatched' ValueReplacer.new(filename).replace(key) end end end |