Sha256: c53f5505dd579b60f7219e8946c9973c8e6b8dcf7ba7511a078988b3761e0964
Contents?: true
Size: 985 Bytes
Versions: 230
Compression:
Stored size: 985 Bytes
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' require 'eac_ruby_utils/struct' module EacCli class Parser class Collector class << self def to_data(definition) collector = new(definition) yield(collector) collector.to_data end end common_constructor :definition do default_values end # @return [OpenStruct] def to_data ::EacRubyUtils::Struct.new(data.transform_keys(&:identifier)) end def collect(option, value) data[option] = option.build_value(value, data[option]) end def supplied?(option) data[option].present? end private def data @data ||= {} end def default_values definition.options.each { |option| data[option] = option.default_value } definition.positional.each { |positional| data[positional] = positional.default_value } end end end end
Version data entries
230 entries across 230 versions & 4 rubygems