class Rubysmith::Renderers::ERB

Renders ERB templates as fully functional files.

Public Class Methods

new(configuration, scope: Renderers::Namespace.new(configuration.project_class), client: ::ERB) click to toggle source
# File lib/rubysmith/renderers/erb.rb, line 9
def initialize configuration,
               scope: Renderers::Namespace.new(configuration.project_class),
               client: ::ERB
  @configuration = configuration
  @scope = scope
  @client = client
end

Public Instance Methods

call(content) click to toggle source
# File lib/rubysmith/renderers/erb.rb, line 17
    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
namespace(= self.buffer = block_given? ? scope.call(yield) : buffer + scope.call) click to toggle source
# File lib/rubysmith/renderers/erb.rb, line 24
  def namespace = self.buffer = block_given? ? scope.call(yield) : buffer + scope.call
end