Module: StillActive::EmojiHelper

Extended by:
EmojiHelper
Included in:
EmojiHelper
Defined in:
lib/helpers/emoji_helper.rb

Instance Method Summary collapse

Instance Method Details

#inactive_gem_emoji(result_hash) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/helpers/emoji_helper.rb', line 9

def inactive_gem_emoji(result_hash)
  most_recent_activity = [
    result_hash.dig(:last_commit_date),
    result_hash.dig(:latest_version_release_date),
    result_hash.dig(:latest_pre_release_version_release_date),
  ].compact.sort.last
  return StillActive.config.unsure_emoji if most_recent_activity.nil?

  case most_recent_activity
  when (StillActive.config.no_warning_range_end.years.ago)..(Time.now)
    ""
  when (StillActive.config.warning_range_end.years.ago)..(StillActive.config.no_warning_range_end.years.ago)
    StillActive.config.warning_emoji
  else
    StillActive.config.critical_warning_emoji
  end
end

#using_latest_emoji(using_last_release:, using_last_pre_release:) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/helpers/emoji_helper.rb', line 27

def using_latest_emoji(using_last_release:, using_last_pre_release:)
  if using_last_release.nil? && using_last_pre_release.nil?
    StillActive.config.unsure_emoji
  elsif using_last_pre_release
    StillActive.config.futurist_emoji
  elsif using_last_release
    StillActive.config.success_emoji
  else
    StillActive.config.warning_emoji
  end
end