Sha256: b2adf292e75660c75afeec80a71299f11bfaf96aaf2ee3fe135f4066b6494030

Contents?: true

Size: 435 Bytes

Versions: 24

Compression:

Stored size: 435 Bytes

Contents

module AnswerHelpers
  def answer(key, &fallback)
    found = get(:answers)[key]
    found.nil? ? fallback.call : found
  end

  def load_answers
    set(:answers, extract_answers(self.class.cli_options))
  end

  private

  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
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
potassium-2.3.0 lib/potassium/helpers/answer-helpers.rb
potassium-2.2.0 lib/potassium/helpers/answer-helpers.rb
potassium-2.1.0 lib/potassium/helpers/answer-helpers.rb
potassium-2.0.0 lib/potassium/helpers/answer-helpers.rb