Sha256: d2423e2f38fc9b06b8e81a291236bbdb966a0ca6a13640a745697e56f5e5af5e
Contents?: true
Size: 1.07 KB
Versions: 4
Compression:
Stored size: 1.07 KB
Contents
# frozen_string_literal: true require 'wordlist/operators/binary_operator' module Wordlist module Operators # # Lazily enumerates over the first wordlist, then the second. # # @since 1.0.0 # class Concat < BinaryOperator # # Enumerates over each word in both wordlists. # # @yield [word] # The given block will be passed each word from both wordlists. # # @yieldparam [String] word # A word from one of the wordlists. # # @return [Enumerator] # If no block is given, an Enumerator object will be returned. # # @example # wordlist1 = Wordlist::Words["foo", "bar", "baz"] # wordlist2 = Wordlist::Words["abc", "xyz"] # (wordlist1 + wordlist2).each do |word| # puts word # end # # foo # # bar # # baz # # abc # # xyz # # @api public # def each(&block) return enum_for(__method__) unless block @left.each(&block) @right.each(&block) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems