Class: Frill::DependencyGraph::Node
- Inherits:
-
Object
- Object
- Frill::DependencyGraph::Node
- Defined in:
- lib/frill/frill.rb
Instance Attribute Summary collapse
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#next ⇒ Object
Returns the value of attribute next.
-
#previous ⇒ Object
Returns the value of attribute previous.
Instance Method Summary collapse
- #first ⇒ Object
-
#initialize(label) ⇒ Node
constructor
A new instance of Node.
- #last ⇒ Object
- #move_before(node) ⇒ Object
Constructor Details
#initialize(label) ⇒ Node
Returns a new instance of Node.
140 141 142 143 144 |
# File 'lib/frill/frill.rb', line 140 def initialize(label) @label = label @next = nil @previous = nil end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
138 139 140 |
# File 'lib/frill/frill.rb', line 138 def label @label end |
#next ⇒ Object
Returns the value of attribute next.
137 138 139 |
# File 'lib/frill/frill.rb', line 137 def next @next end |
#previous ⇒ Object
Returns the value of attribute previous.
137 138 139 |
# File 'lib/frill/frill.rb', line 137 def previous @previous end |
Instance Method Details
#first ⇒ Object
154 155 156 157 158 |
# File 'lib/frill/frill.rb', line 154 def first first_node = self first_node = first_node.previous while first_node.previous first_node end |
#last ⇒ Object
160 161 162 163 164 |
# File 'lib/frill/frill.rb', line 160 def last last_node = self last_node = last_node.next while last_node.next last_node end |
#move_before(node) ⇒ Object
146 147 148 149 150 151 152 |
# File 'lib/frill/frill.rb', line 146 def move_before node next_node = node.first previous_node = self.last previous_node.next = next_node next_node.previous = previous_node end |