mail_classifier.rb
def classification(msg)
      @tokens.each do |token|
        if msg.body =~ /#{token}/m
          begin
            t = token.gsub(/[^a-zA-Z0-9]/, '')
            return Classification.const_get(t).new(msg)
          rescue NameError
            nil
          end
        end
      end

      nil
    end
# Return a class within the Classification module that matches the
# alphanumeric part of the token; if no tokens are found or Classification
# class does not exist, nil is returned.  If multiple tokens could have
# matched, and the corresponding Classification class exists, the first
# match wins; therefore, tokens should be passed in order of highest to
# lowest preference
Return a class within the Classification module that matches the
alphanumeric part of the token; if no tokens are found or Classification
class does not exist, nil is returned.  If multiple tokens could have
matched, and the corresponding Classification class exists, the first
match wins; therefore, tokens should be passed in order of highest to
lowest preference
Return a class within the Classification module that matches the alphanumeric part of the token ; if no tokens are found or Classification class does not exist nil is returned . If multiple tokens could have matched and the corresponding Classification class exists the first match wins ; therefore tokens should be passed in order of highest to lowest preference
def classification(msg)
      @tokens.each do |token|
        if msg.body =~ /#{token}/m
          begin
            t = token.gsub(/[^a-zA-Z0-9]/, '')
            return Classification.const_get(t).new(msg)
          rescue NameError
            nil
          end
        end
      end
      nil
    end
def classification ( msg ) @tokens . each do | token | if msg . body =~ / #{ token } /m begin t = token . gsub ( / [^a-zA-Z0-9] / , '' ) return Classification . const_get ( t ) . new ( msg ) rescue NameError nil end end end nil end
Return a class within the Classification module that matches the
alphanumeric part of the token; if no tokens are found or Classification
class does not exist, nil is returned.
Return a class within the Classification module that matches the alphanumeric part of the token ; if no tokens are found or Classification class does not exist nil is returned .
msg