Sha256: 52a02f407971466fe13d0ada1be6bac9b2754510f94efee2fa92febcbffe64ec
Contents?: true
Size: 775 Bytes
Versions: 195
Compression:
Stored size: 775 Bytes
Contents
# frozen_string_literal: true require 'avm/source_generators/option' require 'eac_ruby_utils/core_ext' module Avm module SourceGenerators class OptionList enable_immutable immutable_accessor :option, type: :array alias immutable_option option def option(*args) immutable_option(::Avm::SourceGenerators::Option.new(*args)) end # @return [Hash<Symbol, String>] def validate(options_hash) options_hash.transform_keys { |k| validate_option(k) } end def validate_option(option_name) option_name = option_name.to_sym return option_name if options.any? { |option| option.name == option_name } raise "No option found with name \"#{option_name}\"" end end end end
Version data entries
195 entries across 195 versions & 2 rubygems