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 |