Sha256: d31a30ae35835c96656d51d92f8dbdc7e59618260ecf97f0bb58116799b00fe4
Contents?: true
Size: 906 Bytes
Versions: 6
Compression:
Stored size: 906 Bytes
Contents
module HammerCLI module Options class OptionCollector attr_accessor :option_sources def initialize(recognised_options, option_sources) @recognised_options = recognised_options @option_sources = option_sources end def all_options_raw @all_options_raw ||= @option_sources.inject({}) do |all_options, source| source.get_options(@recognised_options, all_options) end end def all_options @all_options ||= translate_nils(all_options_raw) end def options @options ||= all_options.reject { |key, value| value.nil? && all_options_raw[key].nil? } end private def translate_nils(opts) Hash[ opts.map { |k,v| [k, translate_nil(v)] } ] end def translate_nil(value) value == HammerCLI::NilValue ? nil : value end end end end
Version data entries
6 entries across 6 versions & 1 rubygems