Skip to content

Commit

Permalink
Don't repeat hard-coded constant
Browse files Browse the repository at this point in the history
  • Loading branch information
cfisoi committed Jan 7, 2024
1 parent fe57eda commit 5aed8b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/ruby-prof/method_info.rb
Expand Up @@ -61,13 +61,15 @@ def ==(other)
end

def <=>(other)
sort_delta = 0.0001

if other.nil?
-1
elsif self.full_name == other.full_name
0
elsif self.total_time < other.total_time && (self.total_time - other.total_time).abs > 0.0001
elsif self.total_time < other.total_time && (self.total_time - other.total_time).abs > sort_delta
-1
elsif self.total_time > other.total_time && (self.total_time - other.total_time).abs > 0.0001
elsif self.total_time > other.total_time && (self.total_time - other.total_time).abs > sort_delta
1
elsif self.call_trees.min_depth < other.call_trees.min_depth
1
Expand Down

0 comments on commit 5aed8b3

Please sign in to comment.