Sha256: 40700af7588f6ec221c1cf23f3e8888115789615ee13e16b0b0cec684b236981

Contents?: true

Size: 297 Bytes

Versions: 10

Compression:

Stored size: 297 Bytes

Contents

module Temple
  module Filters
    # Remove BOM from input string
    #
    # @api public
    class RemoveBOM < Parser
      def call(s)
        return s if s.encoding.name !~ /^UTF-(8|16|32)(BE|LE)?/
        s.gsub(Regexp.new("\\A\uFEFF".encode(s.encoding.name)), '')
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
brakeman-3.3.0 bundle/ruby/2.3.0/gems/temple-0.7.6/lib/temple/filters/remove_bom.rb
angular-rails4-templates-0.4.1 vendor/ruby/2.1.0/gems/temple-0.7.6/lib/temple/filters/remove_bom.rb
angular-rails4-templates-0.4.0 vendor/ruby/2.1.0/gems/temple-0.7.6/lib/temple/filters/remove_bom.rb
angular-rails4-templates-0.3.0 vendor/ruby/2.1.0/gems/temple-0.7.6/lib/temple/filters/remove_bom.rb
temple-0.7.6 lib/temple/filters/remove_bom.rb
temple-0.7.5 lib/temple/filters/remove_bom.rb
temple-0.7.4 lib/temple/filters/remove_bom.rb
temple-0.7.3 lib/temple/filters/remove_bom.rb
temple-0.7.2 lib/temple/filters/remove_bom.rb
temple-0.7.1 lib/temple/filters/remove_bom.rb