Created
June 22, 2015 02:48
-
-
Save carjug/b4dfe3ce924ef0c9ac5f to your computer and use it in GitHub Desktop.
Grandfather Clock -- LtP 14.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def clock some_proc | |
current_time.to_i.times do | |
some_proc.call | |
end | |
end | |
dong = Proc.new do | |
puts "DONG!!!" | |
end | |
def current_time | |
current_time = Time.now.hour | |
if current_time == 0 | |
current_time += 12 | |
else current_time > 12 | |
current_time -= 12 | |
end | |
end | |
clock(dong) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Whoops! used proc syntax instead of block syntax 😄