class Ramda::Internal::Transducers::TakeTransducer
Returns a head of collection
Public Instance Methods
call(limit, reducer)
click to toggle source
limit - number
# File lib/ramda/internal/transducers/take_transducer.rb, line 7 def call(limit, reducer) count = 0 lambda do |acc, x| count += 1 if limit >= count reducer.call(acc, x) else acc end end end