Sha256: b9b7ca4faf5727b47f0cf5eb2879e5b3afd98790f90f09587dbe90ae62e0df7e

Contents?: true

Size: 594 Bytes

Versions: 4

Compression:

Stored size: 594 Bytes

Contents

# frozen_string_literal: true

require "cgi"

module Phlex
	module Rails
		class OutputBuffer < SimpleDelegator
			def safe_append=(value)
				return unless value

				self << case value
					when String then value
					when Symbol then value.name
					else value.to_s
				end
			end

			def append=(value)
				return unless value

				if value.html_safe?
					self.safe_append = value
				else
					self << case value
						when String then CGI.escape_html(value)
						when Symbol then CGI.escape_html(value.name)
						else CGI.escape_html(value.to_s)
					end
				end
			end
		end
	end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
phlex-rails-0.3.2 lib/phlex/rails/output_buffer.rb
phlex-rails-0.3.1 lib/phlex/rails/output_buffer.rb
phlex-rails-0.3.0 lib/phlex/rails/output_buffer.rb
phlex-rails-0.2.2 lib/phlex/rails/output_buffer.rb