Sha256: 523296d3bad2f0d3abb09d57a3f2c3ef6805603d5ff992faf539e9409d6adef6

Contents?: true

Size: 479 Bytes

Versions: 1

Compression:

Stored size: 479 Bytes

Contents

module WLang
  class Template

    attr_reader :dialect, :inner_proc

    def initialize(dialect, inner_proc)
      @dialect    = dialect
      @inner_proc = inner_proc
    end

    def call(scope = {}, buffer = '')
      case i = inner_proc
      when String
        buffer << i
      else
        @dialect.dup.tap do |d|
          d.send(:render, i, scope, buffer)
        end
        buffer
      end
    end
    alias :render :call

  end # class Template
end # module WLang

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wlang-2.0.0.beta lib/wlang/template.rb