Method: WCC::Filters.call

Defined in:
lib/wcc/filter.rb

.call(data, id, args = {}) ⇒ Boolean

API method - invoke the specfied filter and give it’s result.

Parameters:

  • data (Object)

    arbitrary data the filter might use

  • id (String)

    the “name” of the filter

  • args (Hash) (defaults to: {})

    the arguments of the filter

Returns:

  • (Boolean)

    true if filter returned true, false otherwise



36
37
38
39
40
41
42
# File 'lib/wcc/filter.rb', line 36

def self.call(data, id, args = {})
  block = @@filters[id]
  if block.nil?
    raise "Call to requested filter '#{id}' failed - filter not found!"
  end
  block.call(data, args)
end