4
0
mirror of https://github.com/art-ist/mustache-sharp.git synced 2024-06-16 21:05:32 +00:00
MustacheSharp/mustache-sharp/WithBuilder.cs
Travis Parks 827faa5d6e Initial Commit
This is the code almost verbatim from the NList project. This project is
due for a major overhaul, but I don't know the order I will be breaking
out NList in the upcoming weeks.
2013-01-01 21:01:34 -05:00

34 lines
747 B
C#

using System;
using System.Text;
namespace mustache
{
internal sealed class WithBuilder : IBuilder
{
private readonly CompoundBuilder builder;
public WithBuilder()
{
builder = new CompoundBuilder();
}
public string Key
{
get;
set;
}
public CompoundBuilder Builder
{
get { return builder; }
}
public void Build(Scope scope, StringBuilder output, IFormatProvider provider)
{
object value = scope.Find(Key);
Scope valueScope = scope.CreateChildScope(value);
builder.Build(valueScope, output, provider);
}
}
}