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.
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
#as ⇒ Object
Returns the value of attribute as.
61 62 63 |
# File 'lib/support.rb', line 61 def as @as end |
Instance Method Details
#compose ⇒ Object
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 |
#direction ⇒ Object
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 |