Skip to content

Instantly share code, notes, and snippets.

@jsl
Created October 3, 2012 20:44
Show Gist options
  • Save jsl/3829737 to your computer and use it in GitHub Desktop.
Save jsl/3829737 to your computer and use it in GitHub Desktop.
class Node
attr_accessor :next
end
a = Node.new
b = Node.new
c = Node.new
a.next = b
b.next = c
a.circular? => false
c.next = a
a.circular? = true
@g8d3
Copy link

g8d3 commented Oct 3, 2012

def circular?
true if self.next.next === self
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment