Class: Yuzu::Filters::SidebarFilter

Inherits:
Filter show all
Defined in:
lib/yuzu/filters/sidebar.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, registry, #replacement, #value

Constructor Details

#initializeSidebarFilter

Returns a new instance of SidebarFilter.



6
7
8
9
# File 'lib/yuzu/filters/sidebar.rb', line 6

def initialize
  @name = :sidebar
  @directive = "SIDEBAR"
end

Instance Method Details

#default(website_file = nil) ⇒ Object



15
16
17
# File 'lib/yuzu/filters/sidebar.rb', line 15

def default(website_file=nil)
  ""
end

#get_value(website_file) ⇒ Object



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

def get_value(website_file)
  sidebar = match(website_file.raw_contents).to_s
  Yuzu::Translators::Translator.translate(sidebar, website_file.path.extension)
end

#regexObject



11
12
13
# File 'lib/yuzu/filters/sidebar.rb', line 11

def regex
  /SIDEBAR\s*\{([\w\W]*?)\}/
end