Method: OrientSupport::OrientQuery#nodes

Defined in:
lib/support/orientquery.rb

#nodes(in_or_out = :out, via: nil, where: nil, expand: true) ⇒ Object

adds a connection

in_or_out:  :out --->  outE('edgeClass').in[where-condition] 
            :in  --->  inE('edgeClass').out[where-condition]


597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
# File 'lib/support/orientquery.rb', line 597

def nodes in_or_out = :out, via: nil, where: nil, expand: true
	 condition = where.present? ?  "[ #{generate_sql_list(where)} ]" : ""
	 start =  if in_or_out  == :in
							'inE'
						elsif in_or_out ==  :out
							'outE'
						else
							"both"
						end
	 the_end =  if in_or_out == :in 
								'.out' 
							elsif in_or_out == :out
								'.in'
							else
								''
							end
	 argument = " #{start}(#{[via].flatten.map(&:to_or).join(',') if via.present?})#{the_end}#{condition} "

	 if expand.present?
		 send :expand, argument
	 else
		 @q[:projection]  << argument 
	 end
	 self
end