Module: INatChannel::Icons

Defined in:
lib/inat-channel/icons.rb

Constant Summary collapse

TAXA_ICONS =
{
  48460 => "🧬",
  47126 => "🌿",
  47170 => "πŸ„",
  47686 => "🦠",
  151817 => "🦠",
  67333 => "🦠",
  1 => "🐾",
  136329 => "🌲",
  47124 => "🌸",
  47163 => "πŸƒ",
  47178 => "🐟",
  196614 => "🦈",
  47187 => "πŸ¦€",
  47158 => "πŸͺ²",
  47119 => "πŸ•·οΈ",
  71261 => "πŸ¦…",
  18874 => "🦜",
  48222 => "🌊",
  47115 => "🐚",
  3 => "🐦",
  40151 => "🦌",
  26036 => "🐍",
  20978 => "🐸",

# TODO: add ALL taxa with iNat icons and some other large group
}
ICONS =
{
  :user => "πŸ‘€",
  :place => "πŸ—ΊοΈ",
  :calendar => "πŸ“…",
  :location => "πŸ“",
  :observation => "πŸ“·",
  :description => "πŸ“",
  :default_taxon => "🧬",
# TODO: add other icons like calendar, place, etc.
}

Class Method Summary collapse

Class Method Details

.ancestors_icon(ancestor_ids) ⇒ Object



49
50
51
52
53
54
# File 'lib/inat-channel/icons.rb', line 49

def ancestors_icon ancestor_ids 
  ancestor_ids.reverse_each do |ancestor_id|
    return TAXA_ICONS[ancestor_id] if TAXA_ICONS[ancestor_id]
  end
  return ICONS[:default_taxon]
end

.clock_icon(time) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/inat-channel/icons.rb', line 56

def clock_icon time
  hour = time.hour % 12
  minute = time.min

  if minute <= 20
    # ≀20 ΠΌΠΈΠ½ - Ρ‚Π΅ΠΊΡƒΡ‰ΠΈΠΉ час
    case hour
    when 0, 12 then "πŸ•›"
    when 1 then "πŸ•"
    when 2 then "πŸ•‘"
    when 3 then "πŸ•’"
    when 4 then "πŸ•“"
    when 5 then "πŸ•”"
    when 6 then "πŸ••"
    when 7 then "πŸ•–"
    when 8 then "πŸ•—"
    when 9 then "πŸ•˜"
    when 10 then "πŸ•™"
    when 11 then "πŸ•š"
    end
  elsif minute < 40
    # 21-39 ΠΌΠΈΠ½ - полчаса Ρ‚Π΅ΠΊΡƒΡ‰Π΅Π³ΠΎ часа
    case hour
    when 0, 12 then "πŸ•§"
    when 1 then "πŸ•œ"
    when 2 then "πŸ•"
    when 3 then "πŸ•ž"
    when 4 then "πŸ•Ÿ"
    when 5 then "πŸ• "
    when 6 then "πŸ•‘"
    when 7 then "πŸ•’"
    when 8 then "πŸ•£"
    when 9 then "πŸ•€"
    when 10 then "πŸ•₯"
    when 11 then "πŸ•¦"
    end
  else
    # β‰₯40 ΠΌΠΈΠ½ - ΡΠ»Π΅Π΄ΡƒΡŽΡ‰ΠΈΠΉ час
    next_hour = (hour + 1) % 12
    case next_hour
    when 0, 12 then "πŸ•›"
    when 1 then "πŸ•"
    when 2 then "πŸ•‘"
    when 3 then "πŸ•’"
    when 4 then "πŸ•“"
    when 5 then "πŸ•”"
    when 6 then "πŸ••"
    when 7 then "πŸ•–"
    when 8 then "πŸ•—"
    when 9 then "πŸ•˜"
    when 10 then "πŸ•™"
    when 11 then "πŸ•š"
    end
  end
end

.taxon_icon(taxon) ⇒ Object



45
46
47
# File 'lib/inat-channel/icons.rb', line 45

def taxon_icon taxon
  ancestors_icon taxon[:ancestor_ids]
end