Class: Node
- Inherits:
-
Object
- Object
- Node
- Defined in:
- lib/node.rb
Instance Attribute Summary collapse
-
#info ⇒ Object
Returns the value of attribute info.
-
#next ⇒ Object
Returns the value of attribute next.
-
#previous ⇒ Object
Returns the value of attribute previous.
Instance Method Summary collapse
-
#initialize(info, previous: nil, _next: nil) ⇒ Node
constructor
A new instance of Node.
- #to_s ⇒ Object
Constructor Details
#initialize(info, previous: nil, _next: nil) ⇒ Node
Returns a new instance of Node.
5 6 7 8 9 |
# File 'lib/node.rb', line 5 def initialize(info, previous: nil, _next: nil) @info = info @next = _next @previous = previous end |
Instance Attribute Details
#info ⇒ Object
Returns the value of attribute info.
3 4 5 |
# File 'lib/node.rb', line 3 def info @info end |
#next ⇒ Object
Returns the value of attribute next.
3 4 5 |
# File 'lib/node.rb', line 3 def next @next end |
#previous ⇒ Object
Returns the value of attribute previous.
3 4 5 |
# File 'lib/node.rb', line 3 def previous @previous end |
Instance Method Details
#to_s ⇒ Object
11 12 13 14 15 |
# File 'lib/node.rb', line 11 def to_s s = (info == nil)? "nil": "#{@info}" s << ", " if @next != nil s end |