Sha256: a5fc6bdb12127302077e0b27f7d8ec091f823ce171b3a05b8b6fcdc55b593567

Contents?: true

Size: 826 Bytes

Versions: 2

Compression:

Stored size: 826 Bytes

Contents

module ContentState
  class Unclassified < Base
    include Singleton

    def enter_hook(content)
      super
      content[:published] = false
      content[:status_confirmed] = false
    end

    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(feedback)
      classify(feedback)
    end

    def to_s
      "Unclassified"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typo-4.1.1 app/models/content_state/unclassified.rb
typo-4.1 app/models/content_state/unclassified.rb