Module: ChiliProject::Liquid::LiquidExt::Strainer::ClassMethods

Defined in:
lib/chili_project/liquid/liquid_ext/strainer.rb

Instance Method Summary collapse

Instance Method Details

#create_with_filter_array(context) ⇒ Object


40
41
42
43
44
# File 'lib/chili_project/liquid/liquid_ext/strainer.rb', line 40

def create_with_filter_array(context)
  strainer = self.new(context)
  filters.each { |filter| strainer.extend(filter) }
  strainer
end

#global_filter_with_filter_array(filter) ⇒ Object

Raises:

  • (ArgumentError)

35
36
37
38
# File 'lib/chili_project/liquid/liquid_ext/strainer.rb', line 35

def global_filter_with_filter_array(filter)
  raise ArgumentError, "Passed filter is not a module" unless filter.is_a?(Module)
  self.filters += [filter]
end