Module: CmdTools::Commands::MinMax

Extended by:
RubyPatch::AutoLoad
Defined in:
lib/cmd_tools/commands/min_max.rb

Class Method Summary collapse

Class Method Details

.run(str, min_max_separator = "\t") ⇒ Object



5
6
7
8
9
10
11
# File 'lib/cmd_tools/commands/min_max.rb', line 5

def self.run(str, min_max_separator = "\t")
  str.split("\n")\
    .map{|l| l.split.map{|field| field.to_f}}\
    .transpose\
    .map(&:minmax)\
    .map{|min_max| min_max.join(min_max_separator)}
end