Sha256: f9123fee6e5a346213c24a9d14586741356b33a8f261770a9fe2d671b8a32c42
Contents?: true
Size: 770 Bytes
Versions: 4
Compression:
Stored size: 770 Bytes
Contents
require 'json-schema' module GeosparqlToGeojson # Class used to validate GeoJSON # @since 0.1.0 class GeojsonValidator # Creates a new instance of GeosparqlToGeojson::GeojsonValidator # # @param [String] geojson the GeoJSON data to be validated def initialize(geojson) @geojson = geojson @schema = JSON.parse(File.read(File.expand_path('../schema/geojson.json', __FILE__))) end # Validates GeoJSON data based on JSON and GroJSON schemas # # @return [Array] any errors with the JSON def errors JSON::Validator.fully_validate(@schema, @geojson) end # Checks whether there are any errors returned by the validator # # @return [true, false] def valid? errors.empty? end end end
Version data entries
4 entries across 4 versions & 1 rubygems