Sha256: 5019413937df05087dc1957dadd1b4f4043d9a6c76e71bcc6812a1cdb917bd49
Contents?: true
Size: 831 Bytes
Versions: 2
Compression:
Stored size: 831 Bytes
Contents
module VCardio module Validator # # Param name definition: # language-param / value-param / pref-param / pid-param # / type-param / geo-parameter / tz-parameter / sort-as-param # / calscale-param / any-param # # Although the param name definition has a list of possible values the # `any-param` pattern (which includes the `iana-token`) pattern is the least # common denominator. It basically allows param name to match anything that # follows the `1*(ALPHA / DIGIT / "-")` pattern. Therefore that's all we # validate against. # # @private # class ParamNameValidator def self.call(param_name) if /\A[A-Za-z\d-]*\z/.match(param_name).nil? fail VCardio::Error, "Invalid parameter name: #{param_name}" end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vcardio-0.1.1 | lib/vcardio/validator/param_name_validator.rb |
vcardio-0.1.0 | lib/vcardio/validator/param_name_validator.rb |