class Opulent::Filters::Filter

@Filter

Attributes

loaded[RW]
name[RW]
options[RW]

Public Class Methods

new(name, options) click to toggle source

Set tag and attribute options for filter

# File lib/opulent/filters.rb, line 33
def initialize(name, options)
  @name = name
  @options = options
  @loaded = false
end

Public Instance Methods

gem_name() click to toggle source

RubyGems name for explicit library require

# File lib/opulent/filters.rb, line 70
def gem_name
  fail NoMethodError
  # "gem_name"
end
install_error() click to toggle source

Error message to be shown in order to provide installation instructions for the developer

# File lib/opulent/filters.rb, line 57
def install_error
  "gem install #{gem_name}"
end
load_filter() click to toggle source

Error output in case the filter does not exist

# File lib/opulent/filters.rb, line 41
def load_filter
  return if gem_name.nil? || @loaded

  # Try to load the library associated to the chosen filter
  begin
    require gem_name
    @loaded = true
  rescue LoadError
    # Error output with filter name and installation instructions
    Logger.error :compile, :filter_load, @name, install_error
  end
end
render(_code, _options = {}) click to toggle source

Process input code using this filter and return the output to the evaluation method from the Filter Node

# File lib/opulent/filters.rb, line 64
def render(_code, _options = {})
  fail NoMethodError
end