Class: OrientSupport::MatchConnection
- Inherits:
-
Object
- Object
- OrientSupport::MatchConnection
- Defined in:
- lib/support.rb
Instance Attribute Summary collapse
-
#as ⇒ Object
Returns the value of attribute as.
Instance Method Summary collapse
- #compose ⇒ Object
- #direction ⇒ Object
- #direction=(dir) ⇒ Object
-
#initialize(edge: nil, direction: :both, as: nil, count: 1) ⇒ MatchConnection
constructor
A new instance of MatchConnection.
Constructor Details
#initialize(edge: nil, direction: :both, as: nil, count: 1) ⇒ MatchConnection
Returns a new instance of MatchConnection.
58 59 60 61 62 63 |
# File 'lib/support.rb', line 58 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
#as ⇒ Object
Returns the value of attribute as.
57 58 59 |
# File 'lib/support.rb', line 57 def as @as end |
Instance Method Details
#compose ⇒ Object
83 84 85 86 87 |
# File 'lib/support.rb', line 83 def compose ministatement = @as.present? ? "{ as: #{@as} } " : "" (1 .. @count).map{|x| direction }.join("{}") << ministatement end |
#direction ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/support.rb', line 70 def direction fillup = @edge.present? ? @edge : '' case @direction when :both " -#{fillup}- " when :in " <-#{fillup}- " when :out " -#{fillup}-> " end end |
#direction=(dir) ⇒ Object
65 66 67 |
# File 'lib/support.rb', line 65 def direction= dir @direction = dir end |