Class: Yuzu::Filters::LinkrootFilter

Inherits:
Filter show all
Defined in:
lib/yuzu/filters/linkroot.rb

Instance Attribute Summary

Attributes inherited from Filter

#directive, #name

Instance Method Summary collapse

Methods inherited from Filter

#default, filters, #match, #process, registry, #value

Constructor Details

#initializeLinkrootFilter

Returns a new instance of LinkrootFilter.



5
6
7
8
# File 'lib/yuzu/filters/linkroot.rb', line 5

def initialize
  @name = :linkroot
  @directive = "LINKROOT"
end

Instance Method Details

#filter_typeObject



10
11
12
13
14
# File 'lib/yuzu/filters/linkroot.rb', line 10

def filter_type
  # Filter the LINKROOT in IMAGES and other path-dependent tags first, so they have the proper
  # paths to search for. Then process LINKROOT afterwards.
  [:prefilter, :postfilter]
end

#get_match(contents) ⇒ Object



24
25
26
27
# File 'lib/yuzu/filters/linkroot.rb', line 24

def get_match(contents)
  m = contents.match(regex)
  m.nil? ? nil : m[0]
end

#get_value(website_file) ⇒ Object



20
21
22
# File 'lib/yuzu/filters/linkroot.rb', line 20

def get_value(website_file)
  website_file.config.linkroot
end

#regexObject



16
17
18
# File 'lib/yuzu/filters/linkroot.rb', line 16

def regex
  /LINKROOT/
end

#replacement(website_file, processing_contents = nil) ⇒ Object



29
30
31
# File 'lib/yuzu/filters/linkroot.rb', line 29

def replacement(website_file, processing_contents=nil)
  website_file.config.linkroot
end