Module: SEPA::SchemaValidation

Extended by:
ActiveSupport::Concern
Included in:
Message
Defined in:
lib/sepa_rator/concerns/schema_validation.rb

Constant Summary collapse

DEFAULT_SCHEMA_ROOT =
File.expand_path('../../schema', __dir__).freeze
SCHEMA_GEMS =

So missing-schema errors can name the companion gem to install.

{ 'at' => 'sepa_rator-at', 'dk' => 'sepa_rator-dk', 'sps' => 'sepa_rator-sps' }.freeze
SCHEMA_CACHE =

Keyed by resolved absolute path so a late-registered root takes effect immediately.

{}
SCHEMA_CACHE_MUTEX =

rubocop:disable Style/MutableConstant – intentional cache

Mutex.new

Class Method Summary collapse

Class Method Details

.register_schema_root(path) ⇒ Object

Raises:

  • (ArgumentError)


22
23
24
25
26
27
# File 'lib/sepa_rator/concerns/schema_validation.rb', line 22

def register_schema_root(path)
  expanded = File.expand_path(path)
  raise ArgumentError, "register_schema_root: #{expanded} is not a directory" unless File.directory?(expanded)

  schema_roots.unshift(expanded) unless schema_roots.include?(expanded)
end

.schema_rootsObject



18
19
20
# File 'lib/sepa_rator/concerns/schema_validation.rb', line 18

def schema_roots
  @schema_roots ||= [DEFAULT_SCHEMA_ROOT]
end