Class: Sidekiq::Portal::Timeline Private
- Inherits:
-
Object
- Object
- Sidekiq::Portal::Timeline
- Defined in:
- lib/portal/timeline.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: Builder
Instance Method Summary collapse
- #actualize_time! ⇒ void private
- #current_time_point ⇒ Time private
- #initialize(initial_time, timezoner, time_plan) ⇒ void constructor private
- #next_time_point ⇒ Time private
- #time_has_come? ⇒ Boolean private
- #time_points ⇒ Array<Time> private
Constructor Details
#initialize(initial_time, timezoner, time_plan) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 18 19 20 |
# File 'lib/portal/timeline.rb', line 15 def initialize(initial_time, timezoner, time_plan) @timezoner = timezoner @time_plan = time_plan @internal_time = initial_time @lock = Sidekiq::Portal::Lock.new end |
Instance Method Details
#actualize_time! ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
26 27 28 |
# File 'lib/portal/timeline.rb', line 26 def actualize_time! @internal_time = next_time_point end |
#current_time_point ⇒ Time
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
34 35 36 |
# File 'lib/portal/timeline.rb', line 34 def current_time_point thread_safe { timezoner.at(internal_time) } end |
#next_time_point ⇒ Time
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 |
# File 'lib/portal/timeline.rb', line 42 def next_time_point thread_safe { timezoner.at(time_plan.next_time(current_time_point).seconds) } end |
#time_has_come? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
71 72 73 |
# File 'lib/portal/timeline.rb', line 71 def time_has_come? thread_safe { global_time_point >= next_time_point } end |
#time_points ⇒ Array<Time>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/portal/timeline.rb', line 51 def time_points thread_safe do start_time = current_time_point target_time = global_time_point [].tap do |future_points| while start_time <= target_time future_point = timezoner.at(time_plan.next_time(start_time).seconds) next if start_time > future_point future_points.push(future_point) start_time = future_point end end end end |