Class: VagrantWizard::PromptDisplay
- Inherits:
-
Object
- Object
- VagrantWizard::PromptDisplay
- Defined in:
- lib/vagrant-wizard/prompt-display.rb
Instance Attribute Summary collapse
-
#advanced ⇒ Object
Returns the value of attribute advanced.
-
#config_path ⇒ Object
Returns the value of attribute config_path.
-
#defaults_path ⇒ Object
Returns the value of attribute defaults_path.
-
#presets_dir_path ⇒ Object
Returns the value of attribute presets_dir_path.
-
#prompt_overwrite ⇒ Object
Returns the value of attribute prompt_overwrite.
-
#prompt_presets ⇒ Object
Returns the value of attribute prompt_presets.
-
#wizard_path ⇒ Object
Returns the value of attribute wizard_path.
Instance Method Summary collapse
- #display ⇒ Object
-
#initialize ⇒ PromptDisplay
constructor
A new instance of PromptDisplay.
Constructor Details
#initialize ⇒ PromptDisplay
Returns a new instance of PromptDisplay.
18 19 20 21 22 23 24 25 26 |
# File 'lib/vagrant-wizard/prompt-display.rb', line 18 def initialize @defaults_path = nil @wizard_path = nil @config_path = nil @prompt_presets = true @presets_dir_path = nil @prompt_overwrite = true @advanced = false end |
Instance Attribute Details
#advanced ⇒ Object
Returns the value of attribute advanced.
16 17 18 |
# File 'lib/vagrant-wizard/prompt-display.rb', line 16 def advanced @advanced end |
#config_path ⇒ Object
Returns the value of attribute config_path.
12 13 14 |
# File 'lib/vagrant-wizard/prompt-display.rb', line 12 def config_path @config_path end |
#defaults_path ⇒ Object
Returns the value of attribute defaults_path.
10 11 12 |
# File 'lib/vagrant-wizard/prompt-display.rb', line 10 def defaults_path @defaults_path end |
#presets_dir_path ⇒ Object
Returns the value of attribute presets_dir_path.
14 15 16 |
# File 'lib/vagrant-wizard/prompt-display.rb', line 14 def presets_dir_path @presets_dir_path end |
#prompt_overwrite ⇒ Object
Returns the value of attribute prompt_overwrite.
15 16 17 |
# File 'lib/vagrant-wizard/prompt-display.rb', line 15 def prompt_overwrite @prompt_overwrite end |
#prompt_presets ⇒ Object
Returns the value of attribute prompt_presets.
13 14 15 |
# File 'lib/vagrant-wizard/prompt-display.rb', line 13 def prompt_presets @prompt_presets end |
#wizard_path ⇒ Object
Returns the value of attribute wizard_path.
11 12 13 |
# File 'lib/vagrant-wizard/prompt-display.rb', line 11 def wizard_path @wizard_path end |
Instance Method Details
#display ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vagrant-wizard/prompt-display.rb', line 28 def display config = load_config_file if config == nil puts "Error: Wizard configuration file does not exist at `#{@wizard_path}`" return end preset = nil if @prompt_presets preset = show_presets_prompt end results = Hash.new config['prompts'].each do |prompt| result = display_prompt(prompt, preset) results = insert_prompt_output(result, results) end defaults = load_default_config if defaults != nil results = merge_recursively(defaults, results) end output_results(results) end |