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

Constructor Details

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

Instance Method Details

#callObject



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

def call
  least
end

#leastObject



9
10
11
12
13
14
# File 'lib/streamer/functors/least.rb', line 9

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