Module: Neo4j::PropertyValidator

Included in:
Embedded::Property, PropertyContainer
Defined in:
lib/neo4j/property_validator.rb

Defined Under Namespace

Classes: InvalidPropertyException

Constant Summary

VALID_PROPERTY_VALUE_CLASSES =

the valid values on a property, and arrays of those.

Set.new([Array, NilClass, String, Float, TrueClass, FalseClass, Fixnum])

Instance Method Summary (collapse)

Instance Method Details

- (True, False) valid_property?(value)

Returns A false means it can't be persisted.

Parameters:

  • value (Object)

    the value we want to check if it's a valid neo4j property value

Returns:

  • (True, False)

    A false means it can't be persisted.



12
13
14
# File 'lib/neo4j/property_validator.rb', line 12

def valid_property?(value)
  VALID_PROPERTY_VALUE_CLASSES.include?(value.class)
end

- (Object) validate_property(value)



16
17
18
19
20
# File 'lib/neo4j/property_validator.rb', line 16

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