class Stoolie::Filter

Attributes

client[RW]
result[RW]

Public Class Methods

new(client = nil) click to toggle source

Public: takes the class name of the filter client to use - e.g. SmartFilter

# File lib/stoolie/filter.rb, line 11
def initialize(client = nil)
  raise StoolieFilterClientException.new("client must be a Class") if client and !client.is_a?(Class)

  @config = Stoolie.configure

  @client = client || Stoolie.config.client
  @client = @client.send(:new)
end

Public Instance Methods

analyze(input) click to toggle source

Public: analyzes a string for xss, spam and profanity

input - the string to be analyzed

Examples:

analyze('<script>text</script>')
# => #<Stoolie::Result: ...>

Returns a Stoolie::Result object

# File lib/stoolie/filter.rb, line 30
def analyze(input)
  @result = @client.analyze(input)
end