Skip to content

Instantly share code, notes, and snippets.

@lukemorton
Created May 11, 2015 19:40
Show Gist options
  • Save lukemorton/605d7619200c5f1c881a to your computer and use it in GitHub Desktop.
Save lukemorton/605d7619200c5f1c881a to your computer and use it in GitHub Desktop.
# Using instance method
#
class AnagramGrouper
def group(words)
# logic to group anagrams
end
end
AnagramGrouper.new.group(%w(word another bob))
# Using class method (singleton)
#
class AnagramGrouper
def self.group(words)
# logic to group anagrams
end
end
AnagramGrouper.group(%w(word another bob))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment