Sha256: 1165764d2b9ac03c7c5e118b72e7b5e711bfd01d377cb1a00e3bb0fcbaca28be

Contents?: true

Size: 701 Bytes

Versions: 3

Compression:

Stored size: 701 Bytes

Contents

module ContentState
  class Unclassified < Base
    include Reloadable
    include Singleton

    def published?(content)
      classify(content).published?(content)
    end

    def is_spam?(content)
      classify(content).is_spam?(content)
    end

    def classify(content)
      content.state = case content.classify
                      when :ham
                        Factory.new(:just_presumed_ham)
                      when :spam
                        Factory.new(:presumed_spam)
                      else
                        Factory.new(:presumed_spam)
                      end
    end

    def before_save(content)
      classify(content).before_save(content)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
typo-4.0.1 app/models/content_state/unclassified.rb
typo-4.0.2 app/models/content_state/unclassified.rb
typo-4.0.3 app/models/content_state/unclassified.rb