Sha256: c3cd5513346cd56983bfbe69ae08159b99d043ee4556d4d6d64828ca982918d6
Contents?: true
Size: 956 Bytes
Versions: 2
Compression:
Stored size: 956 Bytes
Contents
module PDK class Config # A collection of predefined validators for use with {PDK::Config::Value}. # # @example # value :enabled do # validate PDK::Config::Validator.boolean # end module Validator # @return [Hash{Symbol => [Proc,String]}] a {PDK::Config::Value} # validator that ensures that the value is either a TrueClass or # FalseClass. def self.boolean { proc: ->(value) { [true, false].include?(value) }, message: 'must be a boolean: true or false', } end # @return [Hash{Symbol => [Proc,String]}] a {PDK::Config::Value} # validator that ensures that the value is a String that matches the # regex for a version 4 UUID. def self.uuid { proc: ->(value) { value.match(%r{\A\h{8}(?:-\h{4}){3}-\h{12}\z}) }, message: 'must be a version 4 UUID', } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pdk-2.7.1 | lib/pdk/config/validator.rb |
pdk-2.7.0 | lib/pdk/config/validator.rb |