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
|
# File 'lib/tamai.rb', line 7
def self.station(postal)
puts "数秒お待ちください"
postal_str = postal.to_s
return unless validate(postal_str)
search(postal_str)
if @station.nil?
puts "見つかりませんでした"
return
end
name = @station["name"]
kana = @station["kana"]
line = @station["line"]
distance = @station["distance"].to_i.to_s
prev_station = @station["prev"]
next_station = @station["next"]
puts "最寄駅: " + line + " " + name + " (" + kana + ")駅"
if prev_station.nil?
puts "隣駅: " + next_station
elsif next_station.nil?
puts "隣駅: " + prev_station
else
puts "隣駅: " + prev_station + "、" + next_station
end
puts "ここから約" + distance + "m"
end
|