Sha256: 534c4ba3154c19efa00a6eb1a915e9f6b72dc5d8f58b6ea7ba76ac6a2d4fb9a1
Contents?: true
Size: 808 Bytes
Versions: 16
Compression:
Stored size: 808 Bytes
Contents
# frozen_string_literal: true require "service_skeleton/config_variable" class ServiceSkeleton::ConfigVariable::Enum < ServiceSkeleton::ConfigVariable private def pluck_value(env) maybe_default(env) do v = env[@name.to_s] if @opts[:values].is_a?(Array) unless @opts[:values].include?(v) raise ServiceSkeleton::Error::InvalidEnvironmentError, "Invalid value for #{@name}; must be one of #{@opts[:values].join(", ")}" end v elsif @opts[:values].is_a?(Hash) unless @opts[:values].keys.include?(v) raise ServiceSkeleton::Error::InvalidEnvironmentError, "Invalid value for #{@name}; must be one of #{@opts[:values].keys.join(", ")}" end @opts[:values][v] end end end end
Version data entries
16 entries across 16 versions & 1 rubygems