consul/consul

View on GitHub
app/components/machine_learning/comments_summary_component.rb

Summary

Maintainability
A
0 mins
Test Coverage
class MachineLearning::CommentsSummaryComponent < ApplicationComponent
  attr_reader :commentable

  def initialize(commentable)
    @commentable = commentable
  end

  def render?
    MachineLearning.enabled? && Setting["machine_learning.comments_summary"].present? && body.present?
  end

  private

    def body
      commentable.summary_comment&.body
    end
end