lib/new_relic/agent/heap.rb in newrelic_rpm-8.9.0 vs lib/new_relic/agent/heap.rb in newrelic_rpm-8.10.0
- old
+ new
@@ -1,8 +1,9 @@
# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
+# frozen_string_literal: true
module NewRelic
module Agent
# This class implements a min Heap. The first element is always the one with the
# lowest priority. It is a tree structure that is represented as an array. The
@@ -87,14 +88,14 @@
def priority(index)
@priority_fn.call(@items[index])
end
- def parent_index_for child_index
+ def parent_index_for(child_index)
(child_index - 1) / 2
end
- def left_child_index_for parent_index
+ def left_child_index_for(parent_index)
2 * parent_index + 1
end
def right_sibling_smaller?(lchild_index)
in_range?(lchild_index + 1) && priority(lchild_index) > priority(lchild_index + 1)