module AnswerHelpers

Public Instance Methods

answer(key, &fallback) click to toggle source
# File lib/potassium/helpers/answer-helpers.rb, line 2
def answer(key, &fallback)
  found = get(:answers)[key]
  found.nil? ? fallback.call : found
end
load_answers() click to toggle source
# File lib/potassium/helpers/answer-helpers.rb, line 7
def load_answers
  set(:answers, extract_answers(self.class.cli_options))
end

Private Instance Methods

extract_answers(options) click to toggle source
# File lib/potassium/helpers/answer-helpers.rb, line 13
def extract_answers(options)
  options.except(
    "version-check", :"version-check",
    "force", :force
  ).reduce({}) do |hash, (k, v)|
    hash.merge(k => v == "none" ? nil : v)
  end
end