Class: VCardio::Validator::ParamNameValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/vcardio/validator/param_name_validator.rb

Overview

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.

Class Method Summary collapse

Class Method Details

.call(param_name) ⇒ Object



18
19
20
21
22
# File 'lib/vcardio/validator/param_name_validator.rb', line 18

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