Class: LangGraphRB::FanOutEdge

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

Overview

Fan-out edge that creates multiple parallel executions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from, destinations) ⇒ FanOutEdge

Returns a new instance of FanOutEdge.



82
83
84
85
# File 'lib/langgraph_rb/edge.rb', line 82

def initialize(from, destinations)
  @from = from.to_sym
  @destinations = destinations.map(&:to_sym)
end

Instance Attribute Details

#destinationsObject (readonly)

Returns the value of attribute destinations.



80
81
82
# File 'lib/langgraph_rb/edge.rb', line 80

def destinations
  @destinations
end

#fromObject (readonly)

Returns the value of attribute from.



80
81
82
# File 'lib/langgraph_rb/edge.rb', line 80

def from
  @from
end

Instance Method Details

#inspectObject



95
96
97
# File 'lib/langgraph_rb/edge.rb', line 95

def inspect
  "#<FanOutEdge: #{to_s}>"
end

#route(state, context: nil) ⇒ Object



87
88
89
# File 'lib/langgraph_rb/edge.rb', line 87

def route(state, context: nil)
  @destinations
end

#to_sObject



91
92
93
# File 'lib/langgraph_rb/edge.rb', line 91

def to_s
  "#{@from} -> #{@destinations.inspect}"
end