Sha256: 958515c2d82891325fefd8b5c35aec5752d5a44c53dee55eb42e95c59fa8c5d0

Contents?: true

Size: 1.34 KB

Versions: 12

Compression:

Stored size: 1.34 KB

Contents

module Gluttonberg
  module Content
    class Despamilator

    #This class is the base class of all the despamilator filters.
    #
    #== EXAMPLE:
    #
    #This example is to detect the letter "a". Put the code in
    #lib/despamilator/filter/detect_letter_a.rb:
    #
    #  require 'despamilator/filter_base'
    #
    #  module DespamilatorFilter
    #
    #    class DetectLetterA < Despamilator::FilterBase
    #
    #      def name
    #        'Detecting the letter A'
    #      end
    #
    #      def description
    #        'Detects the letter "a" in a string for no reason other than a demo'
    #      end
    #
    #      def parse text
    #        if text.downcase.scan(/a/)
    #        # add 0.1 to the score of the text
    #        self.append_score = 0.1
    #      end
    #    end
    #  end

      class Filter

        # The nice description of the filter. Usually no more than a sentence.

        def description
          raise "No description defined for #{self.class}"
        end

        # This method parses some text. The score is assigned to the same instance.

        def parse text
          raise "No parser defined for #{self.class}"
        end

        # The one or two word name for the filter.

        def name
          raise "No name defined for #{self.class}"
        end

      end
    end
  end #content
end #Gluttonberg

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
gluttonberg-core-3.0.2 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-3.0.1 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-3.0.0 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-2.6.4 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-2.6.3 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-2.6.2 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-2.6.1 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-2.6.0 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-2.5.9 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-2.5.8 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-2.5.7 lib/gluttonberg/content/despamilator/filter.rb
gluttonberg-core-2.5.6 lib/gluttonberg/content/despamilator/filter.rb