Class: Banzai::Filter::InlineMetricsFilter
- Inherits:
-
InlineEmbedsFilter
- Object
- HTML::Pipeline::Filter
- InlineEmbedsFilter
- Banzai::Filter::InlineMetricsFilter
- Defined in:
- lib/banzai/filter/inline_metrics_filter.rb
Overview
HTML filter that inserts a placeholder element for each reference to a metrics dashboard.
Instance Method Summary collapse
-
#link_pattern ⇒ Object
Regular expression matching metrics urls.
-
#xpath_search ⇒ Object
Search params for selecting metrics links.
Methods inherited from InlineEmbedsFilter
#call, #create_element, #element_to_embed, #embed_params, #gitlab_domain, #query_params
Instance Method Details
#link_pattern ⇒ Object
Regular expression matching metrics urls
17 18 19 |
# File 'lib/banzai/filter/inline_metrics_filter.rb', line 17 def link_pattern Gitlab::Metrics::Dashboard::Url.metrics_regex end |
#xpath_search ⇒ Object
Search params for selecting metrics links. A few simple checks is enough to boost performance without the cost of doing a full regex match.
11 12 13 14 |
# File 'lib/banzai/filter/inline_metrics_filter.rb', line 11 def xpath_search "descendant-or-self::a[contains(@href,'metrics') and \ starts-with(@href, '#{gitlab_domain}')]" end |