Sha256: 5a501c5394185e5ce49120b86cb873d9211acf18f0faa04671cf29d4ed9a98fa

Contents?: true

Size: 539 Bytes

Versions: 5

Compression:

Stored size: 539 Bytes

Contents

require "erb"

module Nyara
  class View
    module ERB
      def self.src template
        @erb_compiler ||= begin
          c            = ::ERB::Compiler.new '<>' # trim mode
          c.pre_cmd    = ["_erbout = @_nyara_view.out"]
          c.put_cmd    = "_erbout.push"   # after newline
          c.insert_cmd = "_erbout.push"   # before newline
          c.post_cmd   = ["_erbout.join"]
          c
        end
        src, enc = @erb_compiler.compile template
        # todo do sth with enc?
        src
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nyara-0.1.pre.2 lib/nyara/view_handlers/erb.rb
nyara-0.1.pre.1 lib/nyara/view_handlers/erb.rb
nyara-0.1.pre.0 lib/nyara/view_handlers/erb.rb
nyara-0.0.1.pre.9 lib/nyara/view_handlers/erb.rb
nyara-0.0.1.pre.8 lib/nyara/view_handlers/erb.rb