Exemplo n.º 1
0
        public override LiquidExpressionResult ApplyTo(ITemplateContext ctx, LiquidString liquidLiquidStringExpression)
        {
            if (liquidLiquidStringExpression == null || String.IsNullOrEmpty(liquidLiquidStringExpression.StringVal))
            {
                return(LiquidExpressionResult.Error("String is nil"));
            }
            var positionFilter = new PositionFilter(LiquidNumeric.Create(liquidLiquidStringExpression.StringVal.Length - 1));

            return(positionFilter.ApplyTo(ctx, liquidLiquidStringExpression));
        }
Exemplo n.º 2
0
        public override LiquidExpressionResult ApplyTo(ITemplateContext ctx, LiquidCollection liquidArrayExpression)
        {
            if (liquidArrayExpression == null || liquidArrayExpression.Value == null)
            {
                return(LiquidExpressionResult.Error("Array is nil"));
            }
            var positionFilter = new PositionFilter(LiquidNumeric.Create(liquidArrayExpression.Count - 1));

            return(positionFilter.ApplyTo(ctx, liquidArrayExpression));
        }
Exemplo n.º 3
0
 public FirstFilter()
 {
     _positionFilter = new PositionFilter(LiquidNumeric.Create(0));
 }