Class: RubyLabs::TSPLab::ItemWithDirection
- Inherits:
-
Struct
- Object
- Struct
- RubyLabs::TSPLab::ItemWithDirection
- Defined in:
- lib/tsplab.rb,
lib/tsplab.rb
Overview
An ItemWithDirection is a struct with two fields, a numeric value and a character that represents right or left, used by the Johnson-Trotter algorithm that generates permutations of points on a map.
Instance Attribute Summary collapse
-
#direction ⇒ Object
Returns the value of attribute direction.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#inspect ⇒ Object
:nodoc:.
Instance Attribute Details
#direction ⇒ Object
Returns the value of attribute direction
23 24 25 |
# File 'lib/tsplab.rb', line 23 def direction @direction end |
#value ⇒ Object
Returns the value of attribute value
23 24 25 |
# File 'lib/tsplab.rb', line 23 def value @value end |
Instance Method Details
#inspect ⇒ Object
:nodoc:
30 31 32 |
# File 'lib/tsplab.rb', line 30 def inspect # :nodoc: (self.direction ? "<" : ">") + self.value.inspect end |