Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove TagRegistry #1845

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/liquid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ module Liquid
require "liquid/version"
require "liquid/deprecations"
require "liquid/const"
require "liquid/template/tag_registry"
require 'liquid/standardfilters'
require 'liquid/file_system'
require 'liquid/parser_switching'
Expand Down
4 changes: 2 additions & 2 deletions lib/liquid/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class << self
# @return [Environment] The new environment instance.
def build(tags: nil, file_system: nil, error_mode: nil, exception_renderer: nil)
ret = new
ret.tags = Template::TagRegistry.new(tags) if tags
ret.tags = tags if tags
ret.file_system = file_system if file_system
ret.error_mode = error_mode if error_mode
ret.exception_renderer = exception_renderer if exception_renderer
Expand Down Expand Up @@ -74,7 +74,7 @@ def dangerously_override(environment)
# Initializes a new environment instance.
# @api private
def initialize
@tags = Template::TagRegistry.new(Tags::STANDARD_TAGS)
@tags = Tags::STANDARD_TAGS.dup
@error_mode = :lax
@strainer_template = Class.new(StrainerTemplate).tap do |klass|
klass.add_filter(StandardFilters)
Expand Down
44 changes: 0 additions & 44 deletions lib/liquid/template/tag_registry.rb

This file was deleted.

21 changes: 1 addition & 20 deletions test/unit/template_unit_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,31 +39,12 @@ def test_with_cache_classes_tags_returns_the_same_class
Liquid.cache_classes = original_cache_setting
end

def test_without_cache_classes_tags_reloads_the_class
original_cache_setting = Liquid.cache_classes
Liquid.cache_classes = false

original_klass = Class.new
Object.send(:const_set, :CustomTag, original_klass)
with_custom_tag('custom', CustomTag) do
Object.send(:remove_const, :CustomTag)

new_klass = Class.new
Object.send(:const_set, :CustomTag, new_klass)

assert(Template.tags['custom'].equal?(new_klass))
end
ensure
Object.send(:remove_const, :CustomTag)
Liquid.cache_classes = original_cache_setting
end

class FakeTag; end

def test_tags_can_be_looped_over
with_custom_tag('fake', FakeTag) do
result = Template.tags.map { |name, klass| [name, klass] }
assert(result.include?(["fake", "TemplateUnitTest::FakeTag"]))
assert(result.include?(["fake", TemplateUnitTest::FakeTag]))
end
end

Expand Down
Loading