Sha256: 56dc6ff20ba5192ec81432cbb10e9289ae6577905fb2ef015eaa76d7d5cfc0f4
Contents?: true
Size: 525 Bytes
Versions: 1
Compression:
Stored size: 525 Bytes
Contents
require 'yaml' module JSONiCal module VEVENTSchema class BadVersionError < ArgumentError; end supported_versions = (1..2) versions = supported_versions.map do |version| [:"v#{version}", YAML.load_file("schemas/v#{version}.yml").freeze] end SCHEMAS = Hash[versions] private_constant(:SCHEMAS) def self.validate!(payload, version:) schema = SCHEMAS[version.to_sym] raise(BadVersionError) if schema.nil? JSON::Validator.validate!(schema, payload) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
JSONiCal-1.0.0 | lib/jsonical/vevent_schema.rb |