-
Notifications
You must be signed in to change notification settings - Fork 1
/
weatherImage.rb
52 lines (49 loc) · 2.03 KB
/
weatherImage.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# coding: utf-8
# 天気予報からイメージ(絵文字)をルックアップテーブルで対応付ける
WEATHER_TO_IMAGE_LOOKUP_TABLE = {
"晴" => "晴れ☀",
"晴時々曇" => "晴れときどき曇り⛅",
"晴時々雨" => "晴れ☀ときどき雨☔",
"晴時々雪" => "晴れ☀ときどき雪❄",
"晴のち曇" => "晴れ☀のち曇り☁",
"晴のち雨" => "晴れ☀のち雨☔",
"晴のち雪" => "晴れ☀のち雪❄",
"晴一時曇" => "晴れ☀いちじ曇り☁",
"晴一時雨" => "晴れ☀いちじ雨☔",
"晴一時雪" => "晴れ☀いちじ雪❄",
"曇" => "曇り☁",
"曇時々晴" => "曇り☁ときどき晴れ☀",
"曇時々雨" => "曇り☁ときどき雨☔",
"曇時々雪" => "曇り☁ときどき雪❄",
"曇のち晴" => "曇り☁のち晴れ☀",
"曇のち雨" => "曇り☁のち雨☔",
"曇のち雪" => "曇り☁のち雪❄",
"曇一時晴" => "曇り☁いちじ晴れ☀",
"曇一時雨" => "曇り☁いちじ雨☔",
"曇一時雪" => "曇り☁いちじ雪❄",
"雨" => "雨☔",
"雨時々晴" => "雨☔ときどき晴れ☀",
"雨時々曇" => "雨☔ときどき曇り☁",
"雨時々雪" => "雨☔ときどき雪❄",
"雨のち晴" => "雨☔のち晴れ☀",
"雨のち曇" => "雨☔のち曇り☁",
"雨のち雪" => "雨☔のち雪❄",
"雨一時晴" => "雨☔いちじ晴れ☀",
"雨一時曇" => "雨☔いちじ曇り☁",
"雨一時雪" => "雨☔いちじ雪❄",
"暴風雨" => "暴風雨☔💨💨",
"雪" => "雪❄",
"雪時々晴" => "雪❄ときどき晴れ☀",
"雪時々曇" => "雪❄ときどき曇り☁",
"雪時々雨" => "雪❄ときどき雨☔",
"雪のち晴" => "雪❄のち晴れ☀",
"雪のち曇" => "雪❄のち曇り☁",
"雪のち雨" => "雪❄のち雨☔",
"雪一時晴" => "雪❄いちじ晴れ☀",
"雪一時曇" => "雪❄いちじ曇り☁",
"雪一時雨" => "雪❄いちじ雨☔",
"暴風雪" => "暴風雪❄💨💨"
}
def get_image(weather)
return WEATHER_TO_IMAGE_LOOKUP_TABLE[weather]
end