Sha256: c29f1a1aadf36487356a3c9ba0a75cbba5b03afa81d9fa6d9dec5db42cb246cc

Contents?: true

Size: 449 Bytes

Versions: 7

Compression:

Stored size: 449 Bytes

Contents

require 'r10k/settings/definition'

module R10K
  module Settings
    class EnumDefinition < R10K::Settings::Definition

      def validate
        if @value
          if !@enum.include?(@value)
            raise ArgumentError, "Setting #{@name} should be one of #{@enum.inspect}, not '#{@value}'"
          end
        end
      end

      private

      def allowed_initialize_opts
        super.merge({:enum => true})
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
r10k-2.3.1 lib/r10k/settings/enum_definition.rb
r10k-2.3.0 lib/r10k/settings/enum_definition.rb
r10k-2.2.2 lib/r10k/settings/enum_definition.rb
r10k-2.2.1 lib/r10k/settings/enum_definition.rb
r10k-2.2.0 lib/r10k/settings/enum_definition.rb
r10k-2.1.1 lib/r10k/settings/enum_definition.rb
r10k-2.1.0 lib/r10k/settings/enum_definition.rb