Sha256: 60c5b15ada12bd7d272b0afd8fc9ee7a6a15b55e56f4e852591fd2ae2381a9ea

Contents?: true

Size: 260 Bytes

Versions: 3

Compression:

Stored size: 260 Bytes

Contents

# frozen_string_literal: true

class YamlValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    YAML.safe_load(value)
  rescue Exception => e
    record.errors.add attribute, e.message.gsub('(<unknown>)', 'invalid')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
auxilium-3.0.31 lib/auxilium/validators/yaml_validator.rb
auxilium-3.0.30 lib/auxilium/validators/yaml_validator.rb
auxilium-3.0.24 lib/auxilium/validators/yaml_validator.rb