Class: Node
- Inherits:
-
Struct
- Object
- Struct
- Node
- Includes:
- Comparable
- Defined in:
- lib/prct06/list.rb,
lib/prct06/list.rb
Overview
create a Struct with :value, :next and :prev
Instance Attribute Summary collapse
-
#nex ⇒ Object
Returns the value of attribute nex.
-
#prev ⇒ Object
Returns the value of attribute prev.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#nex ⇒ Object
Returns the value of attribute nex
2 3 4 |
# File 'lib/prct06/list.rb', line 2 def nex @nex end |
#prev ⇒ Object
Returns the value of attribute prev
2 3 4 |
# File 'lib/prct06/list.rb', line 2 def prev @prev end |
#value ⇒ Object
Returns the value of attribute value
2 3 4 |
# File 'lib/prct06/list.rb', line 2 def value @value end |
Instance Method Details
#<=>(anOther) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/prct06/list.rb', line 6 def <=>(anOther) if anOther.is_a?(Node) value <=> anOther.value else value <=> anOther end end |
#to_s ⇒ Object
13 14 15 |
# File 'lib/prct06/list.rb', line 13 def to_s to_return = "(Value: #{value})" end |