Sha256: 2449448a1cf8a932471f576443fe1fb10684b67fdbf7651307fae4d551fd218c
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
module Arcade class Edge < Base # schema schema.strict # -- throws an error if specified keys are missing attribute :in, Types::Rid attribute :out, Types::Rid def accepted_methods super + [ :vertices, :in, :out, :inV, :outV ] end # # Add Contrains to the edge # CREATE INDEX Watched_out_in ON <edge type« (`@out`, `@in`) UNIQUE # def self.create from:, to:, **attr db.create_edge database_name, from: from, to: to, **attr end def delete db.execute{ "delete edge #{ rid }" }.select_result end ## gets the adjacent Vertex def inV query( projection: "inV()").query.select_result end def outV query( projection: "outV()").query.select_result end def vertices in_or_out = nil case in_or_out when :in inV when :out outV else [inV, outV] end end alias bothV vertices def to_human "<#{self.class.to_s.snake_case}[#{rid}] :.: #{ out }->#{invariant_attributes}->#{ attributes[:in] }>" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
arcadedb-0.4 | lib/model/edge.rb |
arcadedb-0.3.3 | lib/model/edge.rb |