Module: Jerakia::Response::Filter

Defined in:
lib/jerakia/response/filter.rb,
lib/jerakia/response/filter/dig.rb,
lib/jerakia/response/filter/strsub.rb,
lib/jerakia/response/filter/encryption.rb

Defined Under Namespace

Modules: Dig, Encryption, Strsub

Instance Method Summary collapse

Instance Method Details

#filter!(name, opts = {}) ⇒ Object


3
4
5
6
7
8
9
10
11
12
# File 'lib/jerakia/response/filter.rb', line 3

def filter!(name, opts = {})

  unless opts.is_a?(Hash) || opts.is_a?(Array)
    raise Jerakia::PolicyError, "Output filters may only accept hashes or arrays as arguments"
  end
  Jerakia::Util.autoload('response/filter', name)
  Jerakia.log.debug("Invoking output filter #{name}")
  instance_eval "extend Jerakia::Response::Filter::#{name.to_s.capitalize}"
  instance_eval "self.filter_#{name}(#{opts})"
end