-
-
Save kivanio/9670772 to your computer and use it in GitHub Desktop.
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
require 'active_support/core_ext/time' | |
class BusinessHoursFeature | |
# This feature is only available between the hours of 10am and 4pm | |
def enabled? | |
Time.use_zone('Pacific Time (US & Canada)') do | |
now = Time.zone.now | |
am, pm = Time.zone.parse('10:00'), Time.zone.parse('16:00') | |
weekday = !(now.saturday? || now.sunday?) | |
now.between?(am, pm) && weekday | |
end | |
end | |
end | |
module Features | |
class NewRelicSingleSignOn < BusinessHoursFeature; end | |
end | |
Features::NewRelicSingleSignOn.new.enabled? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment