Method: CodeRunner::Run#max
- Defined in:
- lib/coderunner/run.rb
#max(variable, complete = false) ⇒ Object
@@maxes = {} @@cmaxes = {}
878 879 880 881 882 883 884 885 886 887 888 889 |
# File 'lib/coderunner/run.rb', line 878 def max(variable, complete=false) #does this run have the maximum value of this variable raise ArgumentError.new("complete must be true or false") unless [TrueClass, FalseClass].include? complete.class @runner.generate_combined_ids ids = @runner.combined_ids if complete ids = ids.find_all{|id| @runner.combined_run_list[id].status == :Complete} max_id = @runner.cmaxes[variable] ||= ids.sort_by{|id| @runner.combined_run_list[id].send(variable)}[-1] else max_id = @runner.maxes[variable] ||= ids.sort_by{|id| @runner.combined_run_list[id].send(variable)}[-1] end return @runner.combined_run_list[max_id].send(variable) == send(variable) end |