Class: OrientSupport::MatchConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/support.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(edge: nil, direction: :both, as: nil, count: 1) ⇒ MatchConnection

Returns a new instance of MatchConnection.



62
63
64
65
66
67
# File 'lib/support.rb', line 62

def initialize edge: nil, direction: :both, as: nil, count: 1
  @edge = edge
  @direction = direction  # may be :both, :in, :out
  @as =  as
  @count =  count
end

Instance Attribute Details

#asObject

Returns the value of attribute as.



61
62
63
# File 'lib/support.rb', line 61

def as
  @as
end

Instance Method Details

#composeObject



87
88
89
90
91
# File 'lib/support.rb', line 87

def compose
  ministatement = @as.present? ? "{ as: #{@as} } " : "" 
 (1 .. @count).map{|x| direction }.join("{}") << ministatement

end

#directionObject



74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/support.rb', line 74

def direction
  fillup =  @edge.present? ? @edge : ''
  case @direction
  when :both
  " -#{fillup}- "
  when :in
  " <-#{fillup}- "
  when :out
  " -#{fillup}-> "
  end

end

#direction=(dir) ⇒ Object



69
70
71
# File 'lib/support.rb', line 69

def direction= dir
  @direction =  dir
end