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