Sha256: 009351af232027ef4a0bdf1a91aab98d1ccf934f69e9afaaba37c117722a613d

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

require 'fast_haml/text_compiler'

module FastHaml
  module FilterCompilers
    class Base
      protected

      def compile_texts(temple, texts, tab_width: 0)
        tabs = ' ' * tab_width
        texts.each do |text|
          temple << [:static, tabs] << text_compiler.compile(text) << [:static, "\n"]
        end
        nil
      end

      def text_compiler
        @text_compiler ||= TextCompiler.new(escape_html: false)
      end

      def strip_last_empty_lines(texts)
        texts = texts.dup
        while texts.last && texts.last.empty?
          texts.pop
        end
        texts
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fast_haml-0.1.1 lib/fast_haml/filter_compilers/base.rb
fast_haml-0.1.0 lib/fast_haml/filter_compilers/base.rb