Class: Yuzu::Filters::ImagesFilter

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

Instance Attribute Summary

Attributes inherited from Filter

#directive, #name

Instance Method Summary collapse

Methods inherited from Filter

#filter_type, filters, #get_match, #match, #process, #regex, registry, #replacement, #value

Constructor Details

#initializeImagesFilter

Returns a new instance of ImagesFilter.



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

def initialize
  @name = :images
  @directive = "IMAGES"
end

Instance Method Details

#default(website_file = nil) ⇒ Object



10
11
12
# File 'lib/yuzu/filters/images.rb', line 10

def default(website_file=nil)
  []
end

#get_value(website_file) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/yuzu/filters/images.rb', line 14

def get_value(website_file)
  m = match(website_file.raw_contents)
  return default if m.nil?

  images = m.split(",")
  images = images.collect {|img| img.strip}
  images = images.reject {|img| img.empty?}

  images = images.collect {|img|
    img = Filter.filters[:linkroot].process(website_file, img)
    Filter.filters[:currentpath].process(website_file, img)
  }

  images
end