Sha256: 7b932f867505e121affc69cc71a2d6b677002a5abdef5c563118efc59b12d934
Contents?: true
Size: 301 Bytes
Versions: 3
Compression:
Stored size: 301 Bytes
Contents
# frozen_string_literal: true Array.class_eval do # Replace my_array.map(&:method1).map(&:method2) with my_array.pipe(:method1, :method2) # @return [Array] def pipe(*fns) map { |a| fns.reduce(a, &:send) } end end Set.class_eval do extend Forwardable def_delegators :to_a, :pipe end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
pipe_extension-1.0.0 | lib/pipe_extension.rb |
pipe_extension-1.0.0.pre.rc.1 | lib/pipe_extension.rb |
pipe_extension-0.0.6 | lib/pipe_extension.rb |