Skip to content

Instantly share code, notes, and snippets.

@sgonyea
Created December 22, 2010 00:03
Show Gist options
  • Save sgonyea/750848 to your computer and use it in GitHub Desktop.
Save sgonyea/750848 to your computer and use it in GitHub Desktop.
I love Enumerable
# @param [true, false] qt Whether or not Keywords are surrounded by quotes
# @return [Array] The list of all Keyword-words (with quotes if specified)
def self.all_words(qt=false)
words = select(:word).map(&:word)
qt && words.map(&:inspect) || words
end
# :nodoc: because bad enumator-folks also hate documentation and things like life
def self.all_words(qt=false)
words = []
select(:word).each {|w|
words << (qt ? w.word.inspect : w.word)
}
words
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment