Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Merge pull request #10 from g-Off/filter-context
Browse files Browse the repository at this point in the history
introduce the initial FilterContext type that is passed into a FilterFunc
  • Loading branch information
g-Off authored Nov 18, 2019
2 parents d4e8bc3 + 1c95e07 commit 139ae54
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 76 deletions.
6 changes: 3 additions & 3 deletions Sources/Liquid/Expression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ struct Expression: CustomStringConvertible {
} else {
switch filter {
case .size:
result = try? Filters.sizeFilter(value: data, args: [], kwargs: [:], encoder: context.encoder)
result = try? Filters.sizeFilter(value: data, args: [], kwargs: [:], context: FilterContext(context: context))
case .first:
result = try? Filters.firstFilter(value: data, args: [], kwargs: [:], encoder: context.encoder)
result = try? Filters.firstFilter(value: data, args: [], kwargs: [:], context: FilterContext(context: context))
case .last:
result = try? Filters.lastFilter(value: data, args: [], kwargs: [:], encoder: context.encoder)
result = try? Filters.lastFilter(value: data, args: [], kwargs: [:], context: FilterContext(context: context))
}
}
} else {
Expand Down
Loading

0 comments on commit 139ae54

Please sign in to comment.