module Corefines::Enumerable::MapTo
@!method #map_to(klass)
Maps each element of this _enum_ into the _klass_ via constructor. @example ['/tmp', '/var/tmp'].map_to(Pathname) # => [#<Pathname:/tmp>, #<Pathname:/var/tmp>] @param klass [#new] the klass to map each element to. @return [Enumerable] a new array with instances of the _klass_ for every element in _enum_.
Public Instance Methods
map_to(klass)
click to toggle source
# File lib/corefines/enumerable.rb, line 157 def map_to(klass) map { |e| klass.new(e) } end