Class: GuidesStyle18F::ShouldExpandNavTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- GuidesStyle18F::ShouldExpandNavTag
- Defined in:
- lib/guides_style_18f/tags.rb
Constant Summary collapse
- NAME =
'guides_style_18f_should_expand_nav'
Instance Attribute Summary collapse
-
#reference ⇒ Object
readonly
Returns the value of attribute reference.
Instance Method Summary collapse
-
#initialize(_tag_name, markup, _) ⇒ ShouldExpandNavTag
constructor
A new instance of ShouldExpandNavTag.
- #render(context) ⇒ Object
Constructor Details
#initialize(_tag_name, markup, _) ⇒ ShouldExpandNavTag
Returns a new instance of ShouldExpandNavTag.
11 12 13 |
# File 'lib/guides_style_18f/tags.rb', line 11 def initialize(_tag_name, markup, _) @reference = markup.strip end |
Instance Attribute Details
#reference ⇒ Object (readonly)
Returns the value of attribute reference.
9 10 11 |
# File 'lib/guides_style_18f/tags.rb', line 9 def reference @reference end |
Instance Method Details
#render(context) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/guides_style_18f/tags.rb', line 15 def render(context) scope = context.scopes.detect { |s| s.member?(reference) } parent_url = scope[reference] page_url = context['page']['url'] page_url != parent_url && page_url.start_with?(parent_url) end |