Home > BusinessHours

BusinessHours

BusinessHours is a project mainly written in Ruby, it's free.

RPCFN Business Hours #10 Challenge

Business Hours is a Ruby script which will determine the guaranteed time given a business hour schedule. Implements Business Hours, update, closed, closed?, and each iterator for Business Hours. As defined in the RPCFN: Business Hours (#10) challenge:

http://rubylearning.com/blog/2010/05/25/rpcfn-business-hours-10/

Updated from feedback and verified that Day Light Saving time is handled correctly.

Create Business Hour object hours = BusinessHours.new("9:00 AM", "3:00 PM")

Updating Hours: Week Days are updated using Symbol and start/close hours as strings. hours.update :fri, "10:00 AM", "5:00 PM" hours.update :sat, "9:00 AM", "9:30 PM"

Specific Days are updated using a Time or String Object and start/close hours as strings. hours.update "Dec 24, 2010", "8:00 AM", "1:00 PM" hours.update(Time.parse("6/11/2010"), "9:00", "10:00")

Closed Hours: Method specifying days closed, where symbols (week days) and Time or String Objects define specific days. hours.closed :sun, :wed, "Dec 25, 2010"