Sha256: ba506000d666a1a5fb203f9eb1a84f671148235788332c780a40ce2ad55485df

Contents?: true

Size: 654 Bytes

Versions: 2

Compression:

Stored size: 654 Bytes

Contents

class VagrantWizard::Input
  attr_reader :prompt
  attr_reader :data
  attr_reader :output
  attr_accessor :silent

  def initialize(prompt, data)
    @prompt = prompt
    @data = data
    @output = nil
    @silent = false
  end

  def prompt
    if !@silent
      self.processInput
      return @output
    elsif @data.key?('default')
      @output = @data['default']
      return @output
    end
    puts "Warning: input for prompt '#{@data['key']}' has been silenced, but no default value has been provided"
    return @output
  end

  def processInput
    puts "Warning: processInput not implemented for this input type"
    @output = nil
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vagrant-wizard-0.3.0 lib/vagrant-wizard/inputs/input.rb
vagrant-wizard-0.2.0 lib/vagrant-wizard/inputs/input.rb