Sha256: 43fbd2c2e02d6dc04d3a5fbe3cb5ef3f36dcf332d2a8bb69c622bba328a46d78
Contents?: true
Size: 938 Bytes
Versions: 7
Compression:
Stored size: 938 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' module EacRubyUtils module Console class Configs class ReadEntryOptions enable_simple_cache common_constructor :options DEFAULT_VALUES = { before_input: nil, bool: false, list: false, noecho: false, noenv: false, noinput: false, required: true, validator: nil }.freeze def [](key) values.fetch(key.to_sym) end def request_input_options values.slice(:bool, :list, :noecho) end private def values_uncached consumer = options.to_options_consumer r = {} DEFAULT_VALUES.each do |key, default_value| value = consumer.consume(key) value = default_value if value.nil? r[key] = value end consumer.validate r end end end end end
Version data entries
7 entries across 7 versions & 3 rubygems