Sha256: 0c25c02d25ca6b139076cc7e453f4153b42e787e6d9f3d4dbbcd064d4ce7c631

Contents?: true

Size: 925 Bytes

Versions: 90

Compression:

Stored size: 925 Bytes

Contents

# frozen_string_literal: true

require "active_support/core_ext/string/output_safety"

module ActionView
  class OutputBuffer < ActiveSupport::SafeBuffer #:nodoc:
    def initialize(*)
      super
      encode!
    end

    def <<(value)
      return self if value.nil?
      super(value.to_s)
    end
    alias :append= :<<

    def safe_expr_append=(val)
      return self if val.nil?
      safe_concat val.to_s
    end

    alias :safe_append= :safe_concat
  end

  class StreamingBuffer #:nodoc:
    def initialize(block)
      @block = block
    end

    def <<(value)
      value = value.to_s
      value = ERB::Util.h(value) unless value.html_safe?
      @block.call(value)
    end
    alias :concat  :<<
    alias :append= :<<

    def safe_concat(value)
      @block.call(value.to_s)
    end
    alias :safe_append= :safe_concat

    def html_safe?
      true
    end

    def html_safe
      self
    end
  end
end

Version data entries

90 entries across 90 versions & 5 rubygems

Version Path
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/actionview-5.2.3/lib/action_view/buffers.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/actionview-5.2.3/lib/action_view/buffers.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/actionview-5.2.3/lib/action_view/buffers.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/actionview-5.2.3/lib/action_view/buffers.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/actionview-5.2.3/lib/action_view/buffers.rb
spiral_form-0.1.1 vendor/bundle/gems/actionview-5.2.3/lib/action_view/buffers.rb
spiral_form-0.1.0 vendor/bundle/gems/actionview-5.2.3/lib/action_view/buffers.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/actionview-5.2.3/lib/action_view/buffers.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/actionview-5.2.3/lib/action_view/buffers.rb
jets-1.9.7 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.9.6 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.9.5 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.9.4 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.9.3 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.9.2 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.9.1 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.9.0 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.8.14 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.8.13 vendor/rails/actionview/lib/action_view/buffers.rb
jets-1.8.12 vendor/rails/actionview/lib/action_view/buffers.rb