nicojensen.de/vendor/bundle/gems/jekyll-3.8.5/lib/jekyll/liquid_extensions.rb
Nico Jensen b59a203dbb Init
Init commit
2019-03-12 13:49:49 +01:00

24 lines
528 B
Ruby

# frozen_string_literal: true
module Jekyll
module LiquidExtensions
# Lookup a Liquid variable in the given context.
#
# context - the Liquid context in question.
# variable - the variable name, as a string.
#
# Returns the value of the variable in the context
# or the variable name if not found.
def lookup_variable(context, variable)
lookup = context
variable.split(".").each do |value|
lookup = lookup[value]
end
lookup || variable
end
end
end