Class: LangGraphRB::Edge
- Inherits:
-
Object
- Object
- LangGraphRB::Edge
- Defined in:
- lib/langgraph_rb/edge.rb
Overview
Simple edge connecting two nodes
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(from, to) ⇒ Edge
constructor
A new instance of Edge.
- #inspect ⇒ Object
- #route(state, context: nil) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(from, to) ⇒ Edge
6 7 8 9 |
# File 'lib/langgraph_rb/edge.rb', line 6 def initialize(from, to) @from = from.to_sym @to = to.to_sym end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
4 5 6 |
# File 'lib/langgraph_rb/edge.rb', line 4 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
4 5 6 |
# File 'lib/langgraph_rb/edge.rb', line 4 def to @to end |
Instance Method Details
#==(other) ⇒ Object
23 24 25 |
# File 'lib/langgraph_rb/edge.rb', line 23 def ==(other) other.is_a?(Edge) && @from == other.from && @to == other.to end |
#inspect ⇒ Object
19 20 21 |
# File 'lib/langgraph_rb/edge.rb', line 19 def inspect "#<Edge: #{to_s}>" end |
#route(state, context: nil) ⇒ Object
11 12 13 |
# File 'lib/langgraph_rb/edge.rb', line 11 def route(state, context: nil) [@to] end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/langgraph_rb/edge.rb', line 15 def to_s "#{@from} -> #{@to}" end |