Sha256: 261ef6e4c6ed8a2c256ba456b32fa0cf98828fff52c7a60e8c83b6c69a10b85f

Contents?: true

Size: 1.24 KB

Versions: 16

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

require 'singleton'

module Nanoc::Extra
  # @api private
  class JRubyNokogiriWarner
    include Singleton

    TEXT = <<~EOS
      --------------------------------------------------------------------------------
      Note:

      The behavior of Pure Java Nokogiri differs from the Nokogiri used on the
      standard Ruby interpreter (MRI) due to differences in underlying libraries.

      These sometimes problematic behavioral differences can cause Nanoc filters not
      to function properly, if at all. If you need reliable (X)HTML and XML handling
      functionality, consider not using Nokogiri on JRuby for the time being.

      These issues are being worked on both from the Nokogiri and the Nanoc side. Keep
      your Nokogiri and Nanoc versions up to date!

      For details, see https://github.com/nanoc/nanoc/pull/422.
      --------------------------------------------------------------------------------
EOS

    def self.check_and_warn
      instance.check_and_warn
    end

    def initialize
      @warned = false
    end

    def check_and_warn
      return unless defined?(RUBY_ENGINE)
      return if RUBY_ENGINE != 'jruby'
      return if @warned

      $stderr.puts TEXT
      @warned = true
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
nanoc-4.8.10 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.9 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.8 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.7 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.6 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.5 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.4 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.3 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.2 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.1 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.8.0 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.7.14 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.7.13 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.7.12 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.7.11 lib/nanoc/extra/jruby_nokogiri_warner.rb
nanoc-4.7.10 lib/nanoc/extra/jruby_nokogiri_warner.rb