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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 452247b08fcd11c9806f06153e2d8a551759ac6f0cf916bafc0b66de1ede4146
4
- data.tar.gz: 6d1de170fce43559c9366ba454f70c4ff9f7507053b6030ab3f0749bab1d3282
3
+ metadata.gz: '08632b380302ee5a2b70860bc5c60ea3dfed1a1e28dfb160d72b59f563b965fc'
4
+ data.tar.gz: d9ab5cfe642b09cf271cc85d142511ec6f346802d30e359ccf0941aee3b2a79f
5
5
  SHA512:
6
- metadata.gz: 4701ae69ed78db417886d8831ffe563be0b43a1044cd417b52f97220c1d29cf74f02644dd12283a137f60290f5e19ba3df80d5534e8e5e398bf20ea4f8b51008
7
- data.tar.gz: 4d04b04493a5a8f68a0f66fbe6c6e712df0624f629ebff7301bf88d0741818d8318e2259c000ed2d8ba357cc08cbe0a7c3f5e55abae39aeb757542b1a6fb7e62
6
+ metadata.gz: 57079c8c26383947f59a3f690be8634261149b1aca695da1ac461572b3231564f49d8a739a314a8d14a64a544be4b930577ff5cd21853d719a0870be673e116c
7
+ data.tar.gz: c57f6fe1a0cde287243454be84ee711df6d9603621b99b08f43a84199375b0013afe82a37d3c35f4e8c4e3bb50cbddaab2d95fd6e35b95a92e48a6bce3ae59cf
@@ -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"
@@ -62,15 +62,7 @@ module ChronoTrigger
62
62
 
63
63
  private
64
64
 
65
- def moment_in_the_future(time_with_zone)
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
- def right_now
101
- now = Time.zone.now
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
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ChronoTrigger
4
+ module Helpers
5
+ module Now
6
+ def right_now
7
+ now = Time.zone.now
8
+ Time.zone.today + now.hour.hours + now.min.minutes + now.sec.seconds
9
+ end
10
+ end
11
+ end
12
+ end
@@ -63,9 +63,6 @@ module ChronoTrigger
63
63
 
64
64
  private
65
65
 
66
- def right_now
67
- now = Time.zone.now
68
- Time.zone.today + now.hour.hours + now.min.minutes + now.sec.seconds
69
- end
66
+ include ChronoTrigger::Helpers::Now
70
67
  end
71
68
  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
- def right_now
18
- now = Time.zone.now
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChronoTrigger
4
- VERSION = "1.0.2"
4
+ VERSION = "1.0.3"
5
5
  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.2
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