Skip to content

Instantly share code, notes, and snippets.

@atnan
Forked from lachlanhardy/gist:70614
Created February 26, 2009 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atnan/70624 to your computer and use it in GitHub Desktop.
Save atnan/70624 to your computer and use it in GitHub Desktop.
# Would help dramatically if the function and arguments were appropriately named
def f(ra,n)
ra.inject(0) do |accum, value|
value.include?(n) ? accum + 1 : accum
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment