# File lib/ruote/util/filter.rb, line 96
  def self.do_filter(filter, hash, options)

    hash = Rufus::Json.dup(hash)

    hash['~'] = Rufus::Json.dup(hash)
    hash['~~'] = Rufus::Json.dup(options[:double_tilde] || hash)
      # the 'originals'

    deviations = filter.collect { |rule|
      RuleSession.new(hash, rule).run
    }.flatten(1)

    hash.delete('~')
    hash.delete('~~')
    hash.delete('~~~')
      # remove the 'originals'

    if deviations.empty?
      hash
    elsif options[:no_raise]
      deviations
    else
      raise ValidationError.new(deviations)
    end
  end