Sha256: ff9c77ed663bc6afb3f3c5e356c6f7fbe7665b7b107d9cc64e80811d3ac3b5e3

Contents?: true

Size: 641 Bytes

Versions: 7

Compression:

Stored size: 641 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"] << [:newline]
        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

7 entries across 7 versions & 1 rubygems

Version Path
fast_haml-0.1.8 lib/fast_haml/filter_compilers/base.rb
fast_haml-0.1.7 lib/fast_haml/filter_compilers/base.rb
fast_haml-0.1.6 lib/fast_haml/filter_compilers/base.rb
fast_haml-0.1.5 lib/fast_haml/filter_compilers/base.rb
fast_haml-0.1.4 lib/fast_haml/filter_compilers/base.rb
fast_haml-0.1.3 lib/fast_haml/filter_compilers/base.rb
fast_haml-0.1.2 lib/fast_haml/filter_compilers/base.rb