Method: String#each_word
- Defined in:
- lib/core/facets/string/each_word.rb
#each_word(&block) ⇒ Object
Iterate through each word of a string.
a = []
"list of words".each_word { |word| a << word }
a #=> ['list', 'of', 'words']
13 14 15 |
# File 'lib/core/facets/string/each_word.rb', line 13 def each_word(&block) words.each(&block) end |