lib/psd/nodes/ancestry.rb in psd-1.3.3 vs lib/psd/nodes/ancestry.rb in psd-1.4.0
- old
+ new
@@ -36,9 +36,21 @@
def siblings
return [] if parent.nil?
parent.children
end
+ def next_sibling
+ return nil if parent.nil?
+ index = siblings.index(self)
+ siblings[index + 1]
+ end
+
+ def prev_sibling
+ return nil if parent.nil?
+ index = siblings.index(self)
+ siblings[index - 1]
+ end
+
# Does this node have any siblings?
def has_siblings?
siblings.length > 1
end
\ No newline at end of file