Sha256: c2fe5636dc7cd0b5754ce2c2cb31ce7b06a810216ce6fa03a090553111771223

Contents?: true

Size: 557 Bytes

Versions: 17

Compression:

Stored size: 557 Bytes

Contents

# frozen_string_literal: true

module Blacklight
  module Rendering
    class Join < AbstractStep
      def render
        options = config.separator_options || {}
        if values.one? || values.none?
          next_step(values.first)
        elsif !html?
          next_step(values.to_sentence(options))
        else
          next_step(values.map { |x| x.html_safe? ? x : html_escape(x) }.to_sentence(options).html_safe)
        end
      end

      private

      def html_escape(*args)
        ERB::Util.html_escape(*args)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
blacklight-8.6.1 app/presenters/blacklight/rendering/join.rb
blacklight-8.6.0 app/presenters/blacklight/rendering/join.rb
blacklight-8.5.1 app/presenters/blacklight/rendering/join.rb
blacklight-8.5.0 app/presenters/blacklight/rendering/join.rb
blacklight-8.4.0 app/presenters/blacklight/rendering/join.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/blacklight-8.3.0/app/presenters/blacklight/rendering/join.rb
blacklight-8.3.0 app/presenters/blacklight/rendering/join.rb
blacklight-8.2.2 app/presenters/blacklight/rendering/join.rb
blacklight-8.2.1 app/presenters/blacklight/rendering/join.rb
blacklight-8.2.0 app/presenters/blacklight/rendering/join.rb
blacklight-8.1.0 app/presenters/blacklight/rendering/join.rb
blacklight-8.0.1 app/presenters/blacklight/rendering/join.rb
blacklight-8.0.0 app/presenters/blacklight/rendering/join.rb
blacklight-8.0.0.beta8 app/presenters/blacklight/rendering/join.rb
blacklight-8.0.0.beta7 app/presenters/blacklight/rendering/join.rb
blacklight-8.0.0.beta6 app/presenters/blacklight/rendering/join.rb
blacklight-8.0.0.beta5 app/presenters/blacklight/rendering/join.rb