-
Notifications
You must be signed in to change notification settings - Fork 39
rename Liquid 4 has_key to key to add compatibility for liquid 4 #41
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It did fix the error message that prevented Jekyll 3.5 from compiling
Based on the failing tests, we may need to see if context responds to |
What about this? Having each code for both versions: if Gem.loaded_specs['liquid'].version < Gem::Version.create('4.0')
if context.has_key?(gist_id)
gist_id = context[gist_id]
end
if context.has_key?(filename)
filename = context[filename]
end
else
if context.key?(gist_id)
gist_id = context[gist_id]
end
if context.key?(filename)
filename = context[filename]
end
end Until there is another more elegant solution. |
What about a helper method?
if context_contains_key?(context, gist_id)
gist_id = context[gist_id]
end
if context_contains_key?(context, filename)
filename = context[filename]
end
# ...
def context_contains_key?(context, key)
if context.respond_to?(:has_key?)
context.has_key?(key)
else
context.key?(key)
end
end |
@benbalter you're right without a helper it is not backward compatible
|
Works fine on 3.4.3 and 3.5.0 |
Jekyll 2.0 is old enough that I would say no, we don't need support for it. |
@jekyllbot: merge |
Using Liquid 4
key
.