# File lib/new_relic/metric_spec.rb, line 47
  def sub(pattern, replacement, apply_to_scope = true)
    ::NewRelic::Agent.logger.warn("The sub method on metric specs is deprecated") rescue nil
    return nil if name !~ pattern &&
     (!apply_to_scope || scope.nil? || scope !~ pattern)
    new_name = name.sub(pattern, replacement)[LENGTH_RANGE]

    if apply_to_scope
      new_scope = (scope && scope.sub(pattern, replacement)[LENGTH_RANGE])
    else
      new_scope = scope
    end

    self.class.new new_name, new_scope
  end