class GeosparqlToGeojson::GeojsonValidator
Class used to validate GeoJSON @since 0.1.0
Public Class Methods
new(geojson)
click to toggle source
Creates a new instance of GeosparqlToGeojson::GeojsonValidator
.
@param [String] geojson the GeoJSON data to be validated
# File lib/geosparql_to_geojson/geojson_validator.rb, line 15 def initialize(geojson) @geojson = geojson @schema = JSON.parse(File.read(File.expand_path('../schema/geojson.json', __FILE__))) end
Public Instance Methods
errors()
click to toggle source
Validates GeoJSON data based on JSON and GroJSON schemas.
@return [Array] any errors with the JSON
# File lib/geosparql_to_geojson/geojson_validator.rb, line 23 def errors JSON::Validator.fully_validate(@schema, @geojson) end
valid?()
click to toggle source
Checks whether there are any errors returned by the validator.
@return [true, false]
# File lib/geosparql_to_geojson/geojson_validator.rb, line 30 def valid? errors.empty? end