class Wordlist::Modifiers::Upcase

Lazily calls ‘String#upcase` on every word in the wordlist.

@since 1.0.0

Public Instance Methods

each() { |upcase| ... } click to toggle source

Enumerates over every ‘upcase`d word in the wordlist.

@yield [word]

The given block will be passed each `upcase`d word.

@yieldparam [String] word

A `upcase`d word.

@return [Enumerator]

If no block is given, an Enumerator object will be returned.

@example

wordlist = Wordlist::Words["foo", "bar", "baz"]
wordlist.upcase.each do |word|
  puts word
end
# FOO
# BAR
# BAZ

@api public

# File lib/wordlist/modifiers/upcase.rb, line 36
def each
  return enum_for(__method__) unless block_given?

  @wordlist.each do |word|
    yield word.upcase
  end
end