-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclock.rb
34 lines (26 loc) · 830 Bytes
/
clock.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
require "colorize"
digits = [[' _ ', ' ', ' _ ', ' _ ', ' ', ' _ ', ' _ ', ' _ ', ' _ ', ' _ '],
['| |', ' |', ' _|', ' _|', '|_|', '|_ ', '|_ ', ' |', '|_|', '|_|'],
['|_|', ' |', '|_ ', ' _|', ' |', ' _|', '|_|', ' |', '|_|', ' _|']]
i = 1
system ('clear')
loop do
i = 1 if i > 3
sleep(1)
system ('clear')
3.times do |string|
Time.now.strftime('%H').each_char.to_a.each do |num|
print digits[string][num.to_i].blue
end
i == 2 || i == 3 ? print('.'.white) : print(' ')
Time.now.strftime('%M').each_char.to_a.each do |num|
print digits[string][num.to_i].blue
end
i == 2 || i == 3 ? print('.'.white) : print(' ')
Time.now.strftime('%S').each_char.to_a.each do |num|
print digits[string][num.to_i].blue
end
i += 1
puts
end
end