ne-sachirou/stream_stat

View on GitHub
example/1.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

# Aggragate a SD of large_data.

# Monkey patch
module Enumerable
  def last
    inject { |_a, v| v }
  end
end

large_data = (1..100_000).lazy.collect { rand 100_000 }
p StreamStat.new(large_data).last.sd