Ruby quiz (easy) #5

question mark


Monkeypatch the Time class by adding a next_business_day method, which takes the amount of business days as a parameter.

Note: the active_support gem will be helpful for ‘navigating’ days, e.g.

To make things clear, this test case should pass:



  • Say you want to find the 1000th business day, it is not optimal to call Time#tomorrow more than 1000 times. Optimization on that one might fit another quiz question of a harder difficulty level!
  • Introductory article about ‘telling time in Ruby’, where the chronic gem is mentioned, which allows you do to stuff like Chronic.parse('3 months ago this friday at 3:45pm')

Got a comment?

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: