Skip to content

Commit

Permalink
Expose global filter names
Browse files Browse the repository at this point in the history
  • Loading branch information
zzooeeyy committed Jul 21, 2022
1 parent 3fb467f commit c9ec8f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/liquid/strainer_factory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ def create(context, filters = [])
strainer_from_cache(filters).new(context)
end

def global_filter_names
GlobalCache.filter_method_names
end

GlobalCache = Class.new(StrainerTemplate)

private
Expand Down
4 changes: 4 additions & 0 deletions lib/liquid/strainer_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ def inherited(subclass)
subclass.instance_variable_set(:@filter_methods, @filter_methods.dup)
end

def filter_method_names
filter_methods.map(&:to_s).to_a
end

private

def filter_methods
Expand Down

0 comments on commit c9ec8f4

Please sign in to comment.