Module: Neo4j::PropertyValidator
- Included in:
- Embedded::Property, PropertyContainer
- Defined in:
- lib/neo4j/property_validator.rb
Defined Under Namespace
Classes: InvalidPropertyException
Constant Summary collapse
- VALID_PROPERTY_VALUE_CLASSES =
the valid values on a property, and arrays of those.
Set.new([Array, NilClass, String, Float, TrueClass, FalseClass, Integer])
Instance Method Summary collapse
-
#valid_property?(value) ⇒ True, False
A false means it can’t be persisted.
- #validate_property!(value) ⇒ Object
Instance Method Details
#valid_property?(value) ⇒ True, False
Returns 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.any? { |c| value.is_a?(c) } end |
#validate_property!(value) ⇒ Object
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 |