Sha256: ff7e137e413796f5920b001945e7a7ea42792619765f00a9a7edde1765b6bec7

Contents?: true

Size: 513 Bytes

Versions: 7

Compression:

Stored size: 513 Bytes

Contents

module NewRelic
  # A singleton for shared generic helper methods
  module Helper
    extend self

    # confirm a string is correctly encoded (in >= 1.9)
    # If not force the encoding to ASCII-8BIT (binary)
    if RUBY_VERSION >= '1.9'
      def correctly_encoded(string)
        return string unless string.is_a? String
        string.valid_encoding? ? string : string.force_encoding("ASCII-8BIT")
      end
    else
      #noop
      def correctly_encoded(string)
        string
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
ghazel-newrelic_rpm-3.4.0.2 lib/new_relic/helper.rb
newrelic_rpm-3.4.0.1 lib/new_relic/helper.rb
newrelic_rpm-3.4.0 lib/new_relic/helper.rb
newrelic_rpm-3.4.0.beta2 lib/new_relic/helper.rb
newrelic_rpm-3.3.5 lib/new_relic/helper.rb
newrelic_rpm-3.3.5.beta1 lib/new_relic/helper.rb
newrelic_rpm-3.4.0.beta1 lib/new_relic/helper.rb