Sha256: a886525e88f02f1aeee6f06b0f71382991499f315c99a20f890c52607ca96658
Contents?: true
Size: 616 Bytes
Versions: 12
Compression:
Stored size: 616 Bytes
Contents
# frozen_string_literal: true require "erb" module Rubysmith module Renderers # Renders ERB templates as fully functional files. class ERB def initialize realm, scope: Renderers::Namespace.new(realm.project_class), client: ::ERB @realm = realm @scope = scope @client = client end def call content client.new(content, trim_mode: "<>", eoutvar: "@buffer").result binding end private attr_accessor :buffer attr_reader :realm, :scope, :client def namespace self.buffer = scope.call yield end end end end
Version data entries
12 entries across 12 versions & 1 rubygems