Class: NeoScout::GDB_Neo4j::Constraints::PropConstraint

Inherits:
Constraints::PropConstraint show all
Defined in:
lib/neoscout/gdb_neo4j.rb

Instance Attribute Summary

Attributes inherited from Constraints::PropConstraint

#name, #opt, #type

Instance Method Summary collapse

Methods inherited from Constraints::PropConstraint

#initialize, #to_s

Methods inherited from Constraints::Constraint

#satisfied_by_edge?, #satisfied_by_node?

Constructor Details

This class inherits a constructor from NeoScout::Constraints::PropConstraint

Instance Method Details

#satisfied_by?(typer, obj) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
# File 'lib/neoscout/gdb_neo4j.rb', line 9

def satisfied_by?(typer, obj)
  if obj.property?(@name)
    then satisfies_type?(typer, @type, obj[@name])
    else self.opt
  end
end

#satisfies_type?(typer, type, value) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/neoscout/gdb_neo4j.rb', line 16

def satisfies_type?(typer, type, value)
  if type then typer.valid_value?(type, value) else true end
end