# This file is distributed under New Relic’s license terms. # See github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details. # frozen_string_literal: true

module NewRelic::Agent::Instrumentation

module <%= @class_name %>::Chain
  def self.instrument!
    ::<%= @class_name %>.class_eval do
      include NewRelic::Agent::Instrumentation::<%= @class_name %>

      alias_method(:<%= @method.downcase %>_without_new_relic, :<%= @method.downcase %>)

      def <%= @method.downcase %><%= "(#{@args})" unless @args.empty? %>
        <%= @method.downcase %>_with_new_relic<%= "(#{@args})" unless @args.empty? %> do
          <%= @method.downcase %>_without_new_relic<%= "(#{@args})" unless @args.empty? %>
        end
      end
    end
  end
end

end