Skip to content

Instantly share code, notes, and snippets.

@michaelfeathers
Created July 20, 2015 12:29
Show Gist options
  • Save michaelfeathers/47183550dd10914e147b to your computer and use it in GitHub Desktop.
Save michaelfeathers/47183550dd10914e147b to your computer and use it in GitHub Desktop.
def span_count ary
([0] + ary).lazy
.each_cons(2)
.count {|c,n| c == 0 && n != 0 }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment