class JekyllThemeGuidesMbland::PopLastUrlComponent

Constants

NAME

Attributes

reference[R]

Public Class Methods

new(_tag_name, markup, _tokens) click to toggle source
# File lib/jekyll-theme-guides-mbland/tags.rb, line 40
def initialize(_tag_name, markup, _tokens)
  @reference = markup.strip
end

Public Instance Methods

render(context) click to toggle source
# File lib/jekyll-theme-guides-mbland/tags.rb, line 44
def render(context)
  scope = context.scopes.detect { |s| s.member?(reference) }
  parent_url = scope[reference]
  result = File.dirname(parent_url)
  result == '/' ? result : "#{result}/"
end