File: configuration.rb

package info (click to toggle)
ruby-brandur-json-schema 0.19.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 376 kB
  • sloc: ruby: 3,764; makefile: 6
file content (28 lines) | stat: -rw-r--r-- 539 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module JsonSchema
  class Configuration
    attr_accessor :all_of_sub_errors
    attr_reader :custom_formats
    attr_reader :validate_regex_with

    def validate_regex_with=(validator)
      @validate_regex_with = validator
    end

    def register_format(name, validator_proc)
      @custom_formats[name] = validator_proc
    end

    # Used for testing.
    def reset!
      @validate_regex_with = nil
      @custom_formats = {}
      @all_of_sub_errors = false
    end

    private

    def initialize
      reset!
    end
  end
end