lib/arcade/database.rb
def create_edge  edge_class, from:, to:,  **attributes

      content = attributes.empty? ?  "" : "CONTENT #{attributes.to_json}"
      cr = ->( f, t ) do
        edges = Api.execute( database, "create edge #{edge_class} from #{f.rid} to #{t.rid} #{content}").allocate_model
        if edges.is_a?(Array)
          edges.first.rid
        else
          logger.error "Could not create Edge  #{edge_class} from #{f} to #{t}"
          logger.error edges.to_s
        end
      end
      from =  [from] unless from.is_a? Array
      to =  [to] unless to.is_a? Array

      from.map do | from_record |
          to.map { | to_record | cr[ from_record, to_record ] if  to_record.rid? } if from_record.rid?
      end.flatten

    end
#  returns an array of rid's   (same logic as create)
returns an array of rid's   (same logic as create)
returns an array of rid ' s ( same logic as create )
def create_edge  edge_class, from:, to:,  **attributes
      content = attributes.empty? ?  "" : "CONTENT #{attributes.to_json}"
      cr = ->( f, t ) do
        edges = Api.execute( database, "create edge #{edge_class} from #{f.rid} to #{t.rid} #{content}").allocate_model
        if edges.is_a?(Array)
          edges.first.rid
        else
          logger.error "Could not create Edge  #{edge_class} from #{f} to #{t}"
          logger.error edges.to_s
        end
      end
      from =  [from] unless from.is_a? Array
      to =  [to] unless to.is_a? Array
      from.map do | from_record |
          to.map { | to_record | cr[ from_record, to_record ] if  to_record.rid? } if from_record.rid?
      end.flatten
    end
def create_edge edge_class , from : , to : , ** attributes content = attributes . empty? ? "" : "CONTENT #{attributes.to_json}" cr = -> ( f , t ) do edges = Api . execute ( database , "create edge #{edge_class} from #{f.rid} to #{t.rid} #{content}" ) . allocate_model if edges . is_a? ( Array ) edges . first . rid else logger . error "Could not create Edge  #{edge_class} from #{f} to #{t}" logger . error edges . to_s end end from = [ from ] unless from . is_a? Array to = [ to ] unless to . is_a? Array from . map do | from_record | to . map { | to_record | cr [ from_record , to_record ] if to_record . rid? } if from_record . rid? end . flatten end
returns an array of rid's   (same logic as create)
returns an array of rid ' s ( same logic as create )
edge_class
from
to
attributes