alexpchin / contact-codetest

A code test for Contact

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Contact Codetest

We'd like you to write a program to parse a cron string to expand the time fields and output a description of when the command will be run. Using the example above (*/20 1-3 10,11 * * echo hello), your program would output the following:

minute: 0 20 40
hour: 1 2 3
day of month: 10 11
month: 1 2 3 4 5 6 7 8 9 10 11 12
day of week: 1 2 3 4 5 6 7
command: echo hello

Your program will be executed with the cron string given as a single argument, e.g.:

$ ./your-program "*/20 1-3 10,11 * * echo hello"

Solution

$ ruby ./run.rb "*/20 1-3 10,11 * * echo hello" 

Tests

Run tests with:

$ rspec

About

A code test for Contact


Languages

Language:Ruby 100.0%