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-7.2.0 lib/potassium/helpers/answer-helpers.rb
potassium-7.1.0 lib/potassium/helpers/answer-helpers.rb
potassium-7.0.0 lib/potassium/helpers/answer-helpers.rb
potassium-6.7.0 lib/potassium/helpers/answer-helpers.rb
potassium-6.6.0 lib/potassium/helpers/answer-helpers.rb
potassium-6.5.0 lib/potassium/helpers/answer-helpers.rb
potassium-6.4.0 lib/potassium/helpers/answer-helpers.rb
potassium-6.3.0 lib/potassium/helpers/answer-helpers.rb
potassium-6.2.0 lib/potassium/helpers/answer-helpers.rb
potassium-6.1.0 lib/potassium/helpers/answer-helpers.rb
potassium-6.0.0 lib/potassium/helpers/answer-helpers.rb
potassium-5.2.3 lib/potassium/helpers/answer-helpers.rb
potassium-5.2.2 lib/potassium/helpers/answer-helpers.rb
potassium-5.2.1 lib/potassium/helpers/answer-helpers.rb
potassium-5.2.0 lib/potassium/helpers/answer-helpers.rb
potassium-5.1.4 lib/potassium/helpers/answer-helpers.rb
potassium-5.1.3 lib/potassium/helpers/answer-helpers.rb
potassium-5.1.2 lib/potassium/helpers/answer-helpers.rb
potassium-5.1.1 lib/potassium/helpers/answer-helpers.rb
potassium-3.0.0 lib/potassium/helpers/answer-helpers.rb