C# Class DotLiquid.Context

Afficher le fichier Open project: NewSpring/Rock Class Usage Examples

Méthodes publiques

Свойство Type Description
ValueTypeTransformers Dictionary>

Méthodes publiques

Méthode Description
AddFilters ( ) : void
AddFilters ( IEnumerable filters ) : void

Adds filters to this context. this does not register the filters with the main Template object. see Template.register_filter for that

ClearInstanceAssigns ( ) : void
Context ( ) : System
Context ( List environments, Hash outerScope, Hash registers, bool rethrowErrors ) : System
GetValueTypeTransformer ( Type type ) : object>.Func
HandleError ( Exception ex ) : string
HasKey ( string key ) : bool
Invoke ( string method, List args ) : object
Merge ( Hash newScopes ) : void

Merge a hash of variables in the current local scope

Pop ( ) : Hash

Pop from the stack. use Context#stack instead

Push ( Hash newScope ) : void

Push new local scope on the stack. use Context#stack instead

Stack ( System.Action callback ) : void
Stack ( Hash newScope, System.Action callback ) : void

pushes a new local scope on the stack, pops it at the end of the block Example: context.stack do context['var'] = 'hi' end context['var] #=> nil

this ( string key ) : object

Only allow String, Numeric, Hash, Array, Proc, Boolean or Liquid::Drop

Private Methods

Méthode Description
FindVariable ( string key ) : object

Fetches an object starting at the local scope and then moving up the hierarchy

IsHashOrArrayLikeObject ( object obj, object part ) : bool
Liquidize ( object obj ) : object
LookupAndEvaluate ( object obj, object key ) : object
Resolve ( string key ) : object

Look up variable, either resolve directly after considering the name. We can directly handle Strings, digits, floats and booleans (true,false). If no match is made we lookup the variable in the current scope and later move up to the parent blocks to see if we can resolve the variable somewhere up the tree. Some special keywords return symbols. Those symbols are to be called on the rhs object in expressions Example: products == empty #=> products.empty?

SquashInstanceAssignsWithEnvironments ( ) : void
Variable ( string markup ) : object

Resolves namespaced queries gracefully. Example @context['hash'] = {"name" => 'tobi'} assert_equal 'tobi', @context['hash.name'] assert_equal 'tobi', @context['hash["name"]']

Method Details

AddFilters() public méthode

public AddFilters ( ) : void
Résultat void

AddFilters() public méthode

Adds filters to this context. this does not register the filters with the main Template object. see Template.register_filter for that
public AddFilters ( IEnumerable filters ) : void
filters IEnumerable
Résultat void

ClearInstanceAssigns() public méthode

public ClearInstanceAssigns ( ) : void
Résultat void

Context() public méthode

public Context ( ) : System
Résultat System

Context() public méthode

public Context ( List environments, Hash outerScope, Hash registers, bool rethrowErrors ) : System
environments List
outerScope Hash
registers Hash
rethrowErrors bool
Résultat System

GetValueTypeTransformer() public méthode

public GetValueTypeTransformer ( Type type ) : object>.Func
type System.Type
Résultat object>.Func

HandleError() public méthode

public HandleError ( Exception ex ) : string
ex System.Exception
Résultat string

HasKey() public méthode

public HasKey ( string key ) : bool
key string
Résultat bool

Invoke() public méthode

public Invoke ( string method, List args ) : object
method string
args List
Résultat object

Merge() public méthode

Merge a hash of variables in the current local scope
public Merge ( Hash newScopes ) : void
newScopes Hash
Résultat void

Pop() public méthode

Pop from the stack. use Context#stack instead
public Pop ( ) : Hash
Résultat Hash

Push() public méthode

Push new local scope on the stack. use Context#stack instead
public Push ( Hash newScope ) : void
newScope Hash
Résultat void

Stack() public méthode

public Stack ( System.Action callback ) : void
callback System.Action
Résultat void

Stack() public méthode

pushes a new local scope on the stack, pops it at the end of the block Example: context.stack do context['var'] = 'hi' end context['var] #=> nil
public Stack ( Hash newScope, System.Action callback ) : void
newScope Hash
callback System.Action
Résultat void

this() public méthode

Only allow String, Numeric, Hash, Array, Proc, Boolean or Liquid::Drop
public this ( string key ) : object
key string
Résultat object

Property Details

ValueTypeTransformers public_oe property

public Dictionary> ValueTypeTransformers
Résultat Dictionary>