C# Class Stubble.Core.Context

Represents the context for a template
Exibir arquivo Open project: StubbleOrg/Stubble Class Usage Examples

Private Properties

Property Type Description
GetValueFromRegistry object
TryEnumerationConversionIfRequired object

Public Methods

Method Description
Context ( object view, Registry registry, Context parentContext, RenderSettings settings ) : System.Reflection

Initializes a new instance of the Context class.

Context ( object view, Registry registry, RenderSettings settings ) : System.Reflection

Initializes a new instance of the Context class.

IsTruthyValue ( object value ) : bool

Checks if the passed value is Truthy

Lookup ( string name ) : object

Looks up a value by name from the context

Push ( object newView ) : Context

Returns a new Context with the given view and it's parent set as the current context

Private Methods

Method Description
GetValueFromRegistry ( object value, string key ) : object

Gets a value from the registry using the initalized value getters

TryEnumerationConversionIfRequired ( object value ) : object

Tries to convert an object into an Enumeration if possible

Method Details

Context() public method

Initializes a new instance of the Context class.
public Context ( object view, Registry registry, Context parentContext, RenderSettings settings ) : System.Reflection
view object The data view to create the context with
registry Stubble.Core.Classes.Registry A reference to the a registry instance
parentContext Context The parent context for the new context
settings Stubble.Core.Classes.RenderSettings The render settings
return System.Reflection

Context() public method

Initializes a new instance of the Context class.
public Context ( object view, Registry registry, RenderSettings settings ) : System.Reflection
view object The data view to create the context with
registry Stubble.Core.Classes.Registry A reference to the a registry instance
settings Stubble.Core.Classes.RenderSettings The render settings
return System.Reflection

IsTruthyValue() public method

Checks if the passed value is Truthy
public IsTruthyValue ( object value ) : bool
value object The value to check
return bool

Lookup() public method

Looks up a value by name from the context
If ThrowOnDataMiss set then thrown on value not found
public Lookup ( string name ) : object
name string The name of the value to lookup
return object

Push() public method

Returns a new Context with the given view and it's parent set as the current context
public Push ( object newView ) : Context
newView object The data view to create the new context with
return Context