Sha256: 75cfb8ff427464d58ab823dbe013820ce28a427c7e6f17bf9b4f57dee8761b0c
Contents?: true
Size: 820 Bytes
Versions: 32
Compression:
Stored size: 820 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) unless valid_property?(value) raise Neo4j::PropertyValidator::InvalidPropertyException.new("Not valid Neo4j Property value #{value.class}, valid: #{Neo4j::Node::VALID_PROPERTY_VALUE_CLASSES.to_a.join(', ')}") end end end end
Version data entries
32 entries across 32 versions & 1 rubygems