Class: ThinkFeelDoEngine::HarmfulThoughtVizPresenter
- Inherits:
-
Object
- Object
- ThinkFeelDoEngine::HarmfulThoughtVizPresenter
- Defined in:
- app/presenters/think_feel_do_engine/harmful_thought_viz_presenter.rb
Overview
Simplifies the logic of the conditions to display a thought viz
Constant Summary collapse
- TOO_FEW_THOUGHTS =
2
Instance Attribute Summary collapse
-
#pattern_ids ⇒ Object
readonly
Returns the value of attribute pattern_ids.
Instance Method Summary collapse
- #display_viz? ⇒ Boolean
-
#initialize(harmful_thought_ids) ⇒ HarmfulThoughtVizPresenter
constructor
A new instance of HarmfulThoughtVizPresenter.
Constructor Details
#initialize(harmful_thought_ids) ⇒ HarmfulThoughtVizPresenter
Returns a new instance of HarmfulThoughtVizPresenter.
9 10 11 |
# File 'app/presenters/think_feel_do_engine/harmful_thought_viz_presenter.rb', line 9 def initialize(harmful_thought_ids) @pattern_ids = harmful_thought_ids end |
Instance Attribute Details
#pattern_ids ⇒ Object (readonly)
Returns the value of attribute pattern_ids.
7 8 9 |
# File 'app/presenters/think_feel_do_engine/harmful_thought_viz_presenter.rb', line 7 def pattern_ids @pattern_ids end |
Instance Method Details
#display_viz? ⇒ Boolean
13 14 15 16 17 |
# File 'app/presenters/think_feel_do_engine/harmful_thought_viz_presenter.rb', line 13 def display_viz? uniq_pattern_ids .select { |id| compacted_pattern_ids.count(id) > TOO_FEW_THOUGHTS } .present? end |