Shiftly
Factory shift methods collection by RubyLogic, PL
Usage
Add it to your Gemfile with:
gem 'shiftly'
Run the bundle command to install it.
Run generator if needed with:
rails generate shiftly:config
Then you have access to the following extensions.
Time class exts
Time.now.to_factory_date
# returns yesterday when it is before 6am and today otherwise
Time.now.shift
# returns shift number for datetime
Time.now.shift_beg
# returns shift beginning datetime
Time.now.shift_end
# returns shift end datetime
Fixnum class exts
1.next_shift
# returns next shift for 1, 2 or 3
1.prev_shift
# returns previous shift for 1, 2 or 3
License
Copyright © 2012 - 2014 Ruby Logic, released under the MIT license