Class: Streamer::Functors::Least

Inherits:
Functor
  • Object
show all
Defined in:
lib/streamer/functors/least.rb

Overview

least determines the least item in a list

Instance Attribute Summary

Attributes inherited from Functor

#options, #payload

Instance Method Summary collapse

Methods inherited from Functor

#class_name, #initialize, #type_name

Constructor Details

This class inherits a constructor from Streamer::Functors::Functor

Instance Method Details

#callObject



5
6
7
8
9
10
# File 'lib/streamer/functors/least.rb', line 5

def call
  vals = list.map do |item|
    item[options.fetch(:property)]
  end
  vals.sort.shift
end