-
-
Save leejarvis/c82c3b95bb7f1fe72d40 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
module Enumerable | |
def nested_count | |
first.respond_to?(:nested_count) ? 1 + first.nested_count : 0 | |
end | |
end | |
p [[[1,2,3]]].nested_count |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment