Class: Linter::MindsetAssociation

Inherits:
BaseAssociation show all
Defined in:
lib/linter/mindset_association.rb

Constant Summary collapse

USE_FOR_JOB_ADS =
true
FULL_WORD =
false

Constants inherited from BaseAssociation

BaseAssociation::SKIP_WORDS

Class Method Summary collapse

Methods inherited from BaseAssociation

analyze, recommendation_file, word_count

Class Method Details

.add_recommendation(result) ⇒ Object



28
29
30
# File 'lib/linter/mindset_association.rb', line 28

def self.add_recommendation(result)
  recommendation_file.find { |rec| rec['type'] == 'mindset' }&.dig('trends')&.find { |trend| trend['result'] == result.trend }&.dig('recommendation')
end

.calculate_trend(result) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/linter/mindset_association.rb', line 13

def self.calculate_trend(result)
  case result.growth_coded_word_counts.values.sum - result.fixed_coded_word_counts.values.sum
  when 0
    'neutral'
  when 1..3
    'growth-coded'
  when 3..Float::INFINITY
    'strongly growth-coded'
  when -Float::INFINITY..-3
    'strongly fixed-coded'
  else
    'fixed-coded'
  end
end

.wordlistsObject



8
9
10
11
# File 'lib/linter/mindset_association.rb', line 8

def self.wordlists
  file_path = File.join(__dir__, '../../data/mindset_wordlist.yml')
  @wordlists ||= YAML.load_file(file_path)
end