Class: Mores::LinkedList::Node
- Inherits:
-
Object
- Object
- Mores::LinkedList::Node
- Defined in:
- lib/mores/linked_list.rb
Instance Attribute Summary collapse
-
#list ⇒ Object
readonly
Returns the value of attribute list.
-
#next ⇒ Object
readonly
Returns the value of attribute next.
-
#prev ⇒ Object
readonly
Returns the value of attribute prev.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #<(value) ⇒ Object
- #>(value) ⇒ Object
- #delete ⇒ Object
-
#initialize(list, value) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(list, value) ⇒ Node
Returns a new instance of Node.
128 129 130 131 |
# File 'lib/mores/linked_list.rb', line 128 def initialize(list, value) @list = list @value = value end |
Instance Attribute Details
#list ⇒ Object (readonly)
Returns the value of attribute list.
125 126 127 |
# File 'lib/mores/linked_list.rb', line 125 def list @list end |
#next ⇒ Object
Returns the value of attribute next.
125 126 127 |
# File 'lib/mores/linked_list.rb', line 125 def next @next end |
#prev ⇒ Object
Returns the value of attribute prev.
125 126 127 |
# File 'lib/mores/linked_list.rb', line 125 def prev @prev end |
#value ⇒ Object
Returns the value of attribute value.
126 127 128 |
# File 'lib/mores/linked_list.rb', line 126 def value @value end |
Instance Method Details
#<(value) ⇒ Object
133 134 135 136 |
# File 'lib/mores/linked_list.rb', line 133 def <(value) list.send :insert, @prev, self, value self end |
#>(value) ⇒ Object
138 139 140 141 |
# File 'lib/mores/linked_list.rb', line 138 def >(value) list.send :insert, self, @next, value self end |
#delete ⇒ Object
143 144 145 146 147 |
# File 'lib/mores/linked_list.rb', line 143 def delete list.send :remove, self clear value end |