Sha256: bf3b87cda0890b889f8e4ff1b614d1e18d8ade699e300b103ea622bc22dcadd9
Contents?: true
Size: 630 Bytes
Versions: 4
Compression:
Stored size: 630 Bytes
Contents
# frozen_string_literal: true module Leftovers class ConfigLoader class RegexpSchema < StringSchema class << self def validate(node) validate_string(node) && validate_regexp(node) end def validate_string(node) error(node, 'be a string with a valid ruby regexp') unless node.string? node.valid? end def validate_regexp(node) /#{node.to_ruby}/ rescue RegexpError, ArgumentError => e error(node, "be a string with a valid ruby regexp (#{e.message})") else true end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems