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.
147 148 149 150 151 |
# File 'lib/frill/frill.rb', line 147 def initialize(label) @label = label @next = nil @previous = nil end |
Instance Attribute Details
#label ⇒ Object (readonly)
Returns the value of attribute label.
145 146 147 |
# File 'lib/frill/frill.rb', line 145 def label @label end |
#next ⇒ Object
Returns the value of attribute next.
144 145 146 |
# File 'lib/frill/frill.rb', line 144 def next @next end |
#previous ⇒ Object
Returns the value of attribute previous.
144 145 146 |
# File 'lib/frill/frill.rb', line 144 def previous @previous end |
Instance Method Details
#first ⇒ Object
161 162 163 164 165 |
# File 'lib/frill/frill.rb', line 161 def first first_node = self first_node = first_node.previous while first_node.previous first_node end |
#last ⇒ Object
167 168 169 170 171 |
# File 'lib/frill/frill.rb', line 167 def last last_node = self last_node = last_node.next while last_node.next last_node end |
#move_before(node) ⇒ Object
153 154 155 156 157 158 159 |
# File 'lib/frill/frill.rb', line 153 def move_before node next_node = node.first previous_node = self.last previous_node.next = next_node next_node.previous = previous_node end |