Class: Connected::GenericConnection
- Inherits:
-
Object
- Object
- Connected::GenericConnection
- Includes:
- Edge
- Defined in:
- lib/connected/generic_connection.rb
Overview
A generic implementation of an Edge
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#metric ⇒ Object
Returns the value of attribute metric.
-
#state ⇒ Object
Returns the value of attribute state.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(from:, to:, metric: 1, state: :open) ⇒ GenericConnection
constructor
A new instance of GenericConnection.
Methods included from Edge
Constructor Details
#initialize(from:, to:, metric: 1, state: :open) ⇒ GenericConnection
Returns a new instance of GenericConnection.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/connected/generic_connection.rb', line 10 def initialize(from:, to:, metric: 1, state: :open) validate_from(from) validate_to(to) validate_metric(metric) validate_state(state) raise "Invalid Connection from and to same Vertex" if from == to @from = from @to = to @metric = metric @state = state end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
8 9 10 |
# File 'lib/connected/generic_connection.rb', line 8 def from @from end |
#metric ⇒ Object
Returns the value of attribute metric.
8 9 10 |
# File 'lib/connected/generic_connection.rb', line 8 def metric @metric end |
#state ⇒ Object
Returns the value of attribute state.
8 9 10 |
# File 'lib/connected/generic_connection.rb', line 8 def state @state end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
8 9 10 |
# File 'lib/connected/generic_connection.rb', line 8 def to @to end |