chrono_trigger 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chrono_trigger.rb +2 -0
- data/lib/chrono_trigger/event.rb +3 -19
- data/lib/chrono_trigger/helpers/mitf.rb +19 -0
- data/lib/chrono_trigger/helpers/now.rb +12 -0
- data/lib/chrono_trigger/schedule.rb +1 -4
- data/lib/chrono_trigger/timeline.rb +2 -16
- data/lib/chrono_trigger/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08632b380302ee5a2b70860bc5c60ea3dfed1a1e28dfb160d72b59f563b965fc'
|
4
|
+
data.tar.gz: d9ab5cfe642b09cf271cc85d142511ec6f346802d30e359ccf0941aee3b2a79f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57079c8c26383947f59a3f690be8634261149b1aca695da1ac461572b3231564f49d8a739a314a8d14a64a544be4b930577ff5cd21853d719a0870be673e116c
|
7
|
+
data.tar.gz: c57f6fe1a0cde287243454be84ee711df6d9603621b99b08f43a84199375b0013afe82a37d3c35f4e8c4e3bb50cbddaab2d95fd6e35b95a92e48a6bce3ae59cf
|
data/lib/chrono_trigger.rb
CHANGED
@@ -4,6 +4,8 @@ require "rails/engine"
|
|
4
4
|
require "active_support/all"
|
5
5
|
require "singleton"
|
6
6
|
require "concurrent-edge"
|
7
|
+
require "chrono_trigger/helpers/mitf"
|
8
|
+
require "chrono_trigger/helpers/now"
|
7
9
|
require "chrono_trigger/clock"
|
8
10
|
require "chrono_trigger/config"
|
9
11
|
require "chrono_trigger/event"
|
data/lib/chrono_trigger/event.rb
CHANGED
@@ -62,15 +62,7 @@ module ChronoTrigger
|
|
62
62
|
|
63
63
|
private
|
64
64
|
|
65
|
-
|
66
|
-
Time.zone.today + time_with_zone.hour.hours + time_with_zone.min.minutes + time_with_zone.sec.seconds
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
class LostInTimeError < StandardError
|
71
|
-
end
|
72
|
-
|
73
|
-
class TodayIsTomorrowsYesterday < StandardError
|
65
|
+
include ChronoTrigger::Helpers::MITF
|
74
66
|
end
|
75
67
|
|
76
68
|
attr_reader :id, :scope, :args, :every, :before, :after, :purge
|
@@ -97,16 +89,8 @@ module ChronoTrigger
|
|
97
89
|
@purge = true
|
98
90
|
end
|
99
91
|
|
100
|
-
|
101
|
-
|
102
|
-
Time.zone.today + now.hour.hours + now.min.minutes + now.sec.seconds
|
103
|
-
end
|
104
|
-
|
105
|
-
def moment_in_the_future(time_with_zone)
|
106
|
-
raise(LostInTimeError, "Argument must be of type ActiveSupport::TimeWithZone eg. right_now + 1.second") unless time_with_zone.is_a?(ActiveSupport::TimeWithZone)
|
107
|
-
raise(TodayIsTomorrowsYesterday, "Time must be in the future eg. 1.second.from_now") unless time_with_zone.future?
|
108
|
-
Time.zone.today + time_with_zone.hour.hours + time_with_zone.min.minutes + time_with_zone.sec.seconds
|
109
|
-
end
|
92
|
+
include ChronoTrigger::Helpers::MITF
|
93
|
+
include ChronoTrigger::Helpers::Now
|
110
94
|
|
111
95
|
def to_s
|
112
96
|
inspect
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ChronoTrigger
|
4
|
+
module Helpers
|
5
|
+
module MITF
|
6
|
+
class LostInTimeError < StandardError
|
7
|
+
end
|
8
|
+
|
9
|
+
class TodayIsTomorrowsYesterday < StandardError
|
10
|
+
end
|
11
|
+
|
12
|
+
def moment_in_the_future(time_with_zone)
|
13
|
+
raise(LostInTimeError, "Argument must be of type ActiveSupport::TimeWithZone eg. right_now + 1.second") unless time_with_zone.is_a?(ActiveSupport::TimeWithZone)
|
14
|
+
raise(TodayIsTomorrowsYesterday, "Time must be in the future eg. 1.second.from_now") unless time_with_zone.future?
|
15
|
+
Time.zone.today + time_with_zone.hour.hours + time_with_zone.min.minutes + time_with_zone.sec.seconds
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -4,25 +4,11 @@ module ChronoTrigger
|
|
4
4
|
module Timeline
|
5
5
|
extend ::ActiveSupport::Concern
|
6
6
|
|
7
|
-
class LostInTimeError < StandardError
|
8
|
-
end
|
9
|
-
|
10
|
-
class TodayIsTomorrowsYesterday < StandardError
|
11
|
-
end
|
12
|
-
|
13
7
|
def chrono_trigger
|
14
8
|
ChronoTrigger::Schedule.instance
|
15
9
|
end
|
16
10
|
|
17
|
-
|
18
|
-
|
19
|
-
Time.zone.today + now.hour.hours + now.min.minutes + now.sec.seconds
|
20
|
-
end
|
21
|
-
|
22
|
-
def moment_in_the_future(time_with_zone)
|
23
|
-
raise(LostInTimeError, "Argument must be of type ActiveSupport::TimeWithZone eg. right_now + 1.second") unless time_with_zone.is_a?(ActiveSupport::TimeWithZone)
|
24
|
-
raise(TodayIsTomorrowsYesterday, "Time must be in the future eg. 1.second.from_now") unless time_with_zone.future?
|
25
|
-
Time.zone.today + time_with_zone.hour.hours + time_with_zone.min.minutes + time_with_zone.sec.seconds
|
26
|
-
end
|
11
|
+
include ChronoTrigger::Helpers::MITF
|
12
|
+
include ChronoTrigger::Helpers::Now
|
27
13
|
end
|
28
14
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chrono_trigger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- leastbad
|
@@ -161,6 +161,8 @@ files:
|
|
161
161
|
- lib/chrono_trigger/clock.rb
|
162
162
|
- lib/chrono_trigger/config.rb
|
163
163
|
- lib/chrono_trigger/event.rb
|
164
|
+
- lib/chrono_trigger/helpers/mitf.rb
|
165
|
+
- lib/chrono_trigger/helpers/now.rb
|
164
166
|
- lib/chrono_trigger/schedule.rb
|
165
167
|
- lib/chrono_trigger/timeline.rb
|
166
168
|
- lib/chrono_trigger/version.rb
|