Sha256: 4c3c56161221b1620ac6b5ab8bb6d7cde9d58b5daf503ed0827519da57bd3ed4

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

# frozen_string_literal: true

module AsyncPartial
  class HamlArrayBuffer < Array
    def html_safe
      map {|v| AsyncPartial::AsyncResult === v ? v.value : v}.join.html_safe
    end

    def rstrip!
      if last.frozen?
        if (stripped = last.dup.rstrip!)
          self[-1] = stripped
        end
      else
        last.rstrip!
      end
      if last.blank?
        last.pop
        rstrip!
      end
      self
    end
  end

  module HamlArrayBufferizer
    def initialize(*)
      super
      @buffer = AsyncPartial::HamlArrayBuffer.new
    end
  end

  Haml::Buffer.prepend HamlArrayBufferizer
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
async_partial-0.7.0 lib/async_partial/handlers/haml.rb