Sha256: ade66ba153e75e246003ce5c7483adf408846b1e3c0de6968a733fa2f89d80de
Contents?: true
Size: 411 Bytes
Versions: 1
Compression:
Stored size: 411 Bytes
Contents
# frozen_string_literal: true 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.4 | lib/geojsonlint/geojson_validator.rb |