Skip to content

Commit

Permalink
refactor: Move method to private scope
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 2, 2024
1 parent 4399dcc commit b16aa4f
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions AzureLiquid/LiquidParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,6 @@ public LiquidParser SetContent(object? instance, bool forceCamelCase = false)
return SetContentJson(JsonConvert.SerializeObject(instance, settings));
}

/// <summary>
/// Sets the content JSON. Data will be available using the 'content' variable.
/// </summary>
/// <param name="json">The JSON data.</param>
/// <returns>
/// The current instance to use for method chaining.
/// </returns>
public LiquidParser SetContentJson(string json)
{
var content = "{ \"content\": " + json + " }";
var converter = new ExpandoObjectConverter();
var collection = JsonConvert.DeserializeObject<ExpandoObject>(content, converter);

_data = Hash.FromDictionary(new Dictionary<string, object>(collection!));

return this;
}

/// <summary>
/// Sets the content JSON using XML text data as source. Data will be available using the 'content' variable.
/// </summary>
Expand Down Expand Up @@ -124,4 +106,22 @@ private void GuardRender()
throw new LiquidParserException("No template loaded. Call the Parse method before calling Render.");
}
}

/// <summary>
/// Sets the content JSON. Data will be available using the 'content' variable.
/// </summary>
/// <param name="json">The JSON data.</param>
/// <returns>
/// The current instance to use for method chaining.
/// </returns>
private LiquidParser SetContentJson(string json)
{
var content = "{ \"content\": " + json + " }";
var converter = new ExpandoObjectConverter();
var collection = JsonConvert.DeserializeObject<ExpandoObject>(content, converter);

_data = Hash.FromDictionary(new Dictionary<string, object>(collection!));

return this;
}
}

0 comments on commit b16aa4f

Please sign in to comment.