class UuidValidator
Constants
- VERSIONS
Public Instance Methods
validate_each(record, attribute, value)
click to toggle source
Calls superclass method
BaseValidator#validate_each
# File lib/lite/validators/uuid_validator.rb, line 12 def validate_each(record, attribute, value) assert_valid_version! super end
Private Instance Methods
assert_valid_version!()
click to toggle source
# File lib/lite/validators/uuid_validator.rb, line 19 def assert_valid_version! return unless options.key?(:version) assert_valid_option!(:version, VERSIONS.keys) end
valid_regexp?()
click to toggle source
# File lib/lite/validators/uuid_validator.rb, line 29 def valid_regexp? if options.key?(:version) value.to_s =~ VERSIONS[version] else VERSIONS.any? { |_, regexp| value.to_s =~ regexp } end end
version()
click to toggle source
# File lib/lite/validators/uuid_validator.rb, line 25 def version options[:version] || :any end