Method: H2o::Context#apply_filters

Defined in:
lib/h2o/context.rb

#apply_filters(object, filters) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/h2o/context.rb', line 91

def apply_filters(object, filters)
  filters.each do |filter|
    name, *args = filter

    raise FilterError, "Filter(#{name}) not found" unless @filter_env.respond_to?(name)
    
    args.map! do |arg|
      if arg.kind_of? Symbol
        resolve(arg)
      else
        arg
      end
    end

    object = @filter_env.__send__(name, object, *args)
  end
  object
end