Sha256: 9770670a7c52f671ac6fb74c3926bc85c3e6fd1426023dd1c41b015b53abfb32
Contents?: true
Size: 380 Bytes
Versions: 1
Compression:
Stored size: 380 Bytes
Contents
require 'active_model' class GeojsonValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) unless valid_geojson?(value) message = options[:message] || "is invalid" record.errors.add(attribute, message) end end private # @return [Boolean] def valid_geojson?(geojson) Geojsonlint.validate(geojson).valid? end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
geojsonlint-0.1.3 | lib/geojsonlint/geojson_validator.rb |