Class: UV::Scheduler::TimeInZone
- Inherits:
-
Object
- Object
- UV::Scheduler::TimeInZone
- Defined in:
- lib/uv-rays/scheduler/time.rb
Overview
Thread safe timezone time class for use with parse-cron
Instance Method Summary collapse
-
#initialize(timezone) ⇒ TimeInZone
constructor
A new instance of TimeInZone.
- #local(*args) ⇒ Object
- #now ⇒ Object
Constructor Details
#initialize(timezone) ⇒ TimeInZone
Returns a new instance of TimeInZone.
35 36 37 |
# File 'lib/uv-rays/scheduler/time.rb', line 35 def initialize(timezone) @timezone = timezone end |
Instance Method Details
#local(*args) ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/uv-rays/scheduler/time.rb', line 47 def local(*args) result = nil Time.use_zone(@timezone) do result = Time.local(*args) end result end |
#now ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/uv-rays/scheduler/time.rb', line 39 def now time = nil Time.use_zone(@timezone) do time = Time.now end time end |