Sha256: 29a9f3787fbb269615451e5b63466f8c631dea3bffb955b91e327adecc86efa0
Contents?: true
Size: 807 Bytes
Versions: 8
Compression:
Stored size: 807 Bytes
Contents
module Neo4j module PropertyValidator require 'set' class InvalidPropertyException < Exception end # the valid values on a property, and arrays of those. VALID_PROPERTY_VALUE_CLASSES = Set.new([Array, NilClass, String, Float, TrueClass, FalseClass, Fixnum]) # @param [Object] value the value we want to check if it's a valid neo4j property value # @return [True, False] A false means it can't be persisted. def valid_property?(value) VALID_PROPERTY_VALUE_CLASSES.include?(value.class) end def validate_property(value) return if valid_property?(value) fail Neo4j::PropertyValidator::InvalidPropertyException, "Not valid Neo4j Property value #{value.class}, valid: #{Neo4j::Node::VALID_PROPERTY_VALUE_CLASSES.to_a.join(', ')}" end end end
Version data entries
8 entries across 8 versions & 1 rubygems