Sha256: b9de71348af2b1766fffbb390eb6106578c161d7b1e089a92674b3182cf2f456

Contents?: true

Size: 497 Bytes

Versions: 63

Compression:

Stored size: 497 Bytes

Contents

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

Version data entries

63 entries across 63 versions & 3 rubygems

Version Path
jekyll-3.5.2 lib/jekyll/liquid_extensions.rb
jekyll-3.5.1 lib/jekyll/liquid_extensions.rb
jekyll-3.4.5 lib/jekyll/liquid_extensions.rb
jekyll-3.5.0 lib/jekyll/liquid_extensions.rb
jekyll-3.4.4 lib/jekyll/liquid_extensions.rb
jekyll-3.4.3 lib/jekyll/liquid_extensions.rb
jekyll-3.4.2 lib/jekyll/liquid_extensions.rb
jekyll-3.4.1 lib/jekyll/liquid_extensions.rb
jekyll-3.4.0 lib/jekyll/liquid_extensions.rb
jekyll-3.3.1 lib/jekyll/liquid_extensions.rb
jekyll-3.3.0 lib/jekyll/liquid_extensions.rb
jekyll-3.3.0.pre.rc1 lib/jekyll/liquid_extensions.rb
jekyll-3.2.1 lib/jekyll/liquid_extensions.rb
jekyll-3.2.0 lib/jekyll/liquid_extensions.rb
jekyll-3.2.0.pre.beta2 lib/jekyll/liquid_extensions.rb
blackboard-3.1.9 lib/jekyll/liquid_extensions.rb
blackboard-3.1.8 lib/jekyll/liquid_extensions.rb
blackboard-3.1.7 lib/jekyll/liquid_extensions.rb
jekyll-3.2.0.pre.beta1 lib/jekyll/liquid_extensions.rb
jekyll-3.1.6 lib/jekyll/liquid_extensions.rb