Skip to content

Instantly share code, notes, and snippets.

@tigawa
Created February 26, 2013 22:51
Show Gist options
  • Save tigawa/5043111 to your computer and use it in GitHub Desktop.
Save tigawa/5043111 to your computer and use it in GitHub Desktop.
ruby 2.0 keyword param
def count_word_from_file(path: "~/default.txt", word:"default")
file = File.read(path)
return file.split.select{|w| w==word}.size
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment