Sha256: 6e9eddbfda919bf8cac5acc90f033d96cb7532d9485d86be275821d9d6b5e957

Contents?: true

Size: 540 Bytes

Versions: 1

Compression:

Stored size: 540 Bytes

Contents

class Mysql2QueryFilter::QueryFilter
  def initialize
    @filters = []
  end

  def plugin(name, options = {})
    filter_class = Mysql2QueryFilter::Plugins[name]
    add(filter_class, options)
  end

  def add(filter_class, options = {})
    unless filter_class < Mysql2QueryFilter::Plugin::Filter
      raise "Invalid plug-in has been appended: #{filter_class}"
    end

    @filters << filter_class.new(options)
  end

  def filter(sql, query_options)
    @filters.each do |fltr|
      fltr.filter(sql, query_options)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mysql2_query_filter-0.0.5 lib/mysql2_query_filter/query_filter.rb