time_egg 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2a8e4eb6ffd7e4c205b4747c912652aa4ed62ab7cf74bd146af0f11aa377e23b
4
+ data.tar.gz: fb53fc847598bc11694b791ff66e98e9296ba6b595d579bff7d694d2804452e5
5
+ SHA512:
6
+ metadata.gz: 66be56559cd3ed5da3cdc36de3b65204e809cfd4d1f935b12411ce40233a01c6a62b1ece12ec75dfbf5826b1b7889c4564512c6a06ff7cca128a43c0824fe5df
7
+ data.tar.gz: f85c3fb59cd57e037b65a9ce44d6350e139eddc51f6ca24b9e3f3e7db3e74975eeb759b23407e8cff3477f1282b70c15670abbabc4f143685a2511ef387761fa
@@ -0,0 +1,209 @@
1
+ class CharactersQuotes
2
+ def self.execution_quotes
3
+ [
4
+ {
5
+ start: "\e[34mChrono raises his blade high: 'Let’s start this!'\e[0m",
6
+ finish: "\e[32mChrono lowers his blade: 'It’s done. The path is clear.'\e[0m",
7
+ failure: -> (error) { "\e[31mChrono falters mid-swing, his grip trembling: 'The strike didn’t land. The shadows whisper of an error: \"\e[35m#{error.message}\e[31m\".'\e[0m" }
8
+ },
9
+ {
10
+ start: "\e[34mLucca powers up her contraption: 'Initiating the sequence!'\e[0m",
11
+ finish: "\e[32mLucca wipes her goggles: 'Sequence complete! Everything’s working perfectly.'\e[0m",
12
+ failure: -> (error) { "\e[31mLucca slaps her machine, sparks flying: 'The system’s malfunctioned! Error detected: \"\e[35m#{error.message}\e[31m\".'\e[0m" }
13
+ },
14
+ {
15
+ start: "\e[34mMarle steadies her crossbow: 'The moment is here!'\e[0m",
16
+ finish: "\e[32mMarle smiles with relief: 'That’s a bullseye!'\e[0m",
17
+ failure: -> (error) { "\e[31mMarle lowers her crossbow with a sigh: 'I missed... something’s off. Error: \"\e[35m#{error.message}\e[31m\".'\e[0m" }
18
+ },
19
+ {
20
+ start: "\e[34mFrog raises the Masamune: 'Let us strike with honor and valor!'\e[0m",
21
+ finish: "\e[32mFrog sheathes the Masamune: 'The deed is done. Honor and time are preserved.'\e[0m",
22
+ failure: -> (error) { "\e[31mFrog kneels solemnly, the Masamune trembling in his hands: 'T’is ill fortune. The strike hath failed us. Error: \"\e[35m#{error.message}\e[31m\".'\e[0m" }
23
+ },
24
+ {
25
+ start: "\e[34mMagus glances to the sky: 'The gears of fate are in motion now.'\e[0m",
26
+ finish: "\e[32mMagus folds his arms: 'The outcome is clear. Let us proceed.'\e[0m",
27
+ failure: -> (error) { "\e[31mMagus glares into the void, his voice low: 'The threads of destiny slip from my grasp. Error: \"\e[35m#{error.message}\e[31m\". Fate resists me... for now.'\e[0m" }
28
+ },
29
+ {
30
+ start: "\e[34mAyla shouts: 'Me start smash now!'\e[0m",
31
+ finish: "\e[32mAyla cheers: 'Smash done! Me ready for next one!'\e[0m",
32
+ failure: -> (error) { "\e[31mAyla groans, frustrated: 'Smash no work. Error say: \"\e[35m#{error.message}\e[31m\". Ayla fix and try again!'\e[0m" }
33
+ },
34
+ {
35
+ start: "\e[34mRobo activates his systems: 'Executing command protocol...'\e[0m",
36
+ finish: "\e[32mRobo powers down slightly: 'Command executed. Awaiting next input.'\e[0m",
37
+ failure: -> (error) { "\e[31mRobo’s circuits flicker, a faint whir escaping: 'Critical error detected: \"\e[35m#{error.message}\e[31m\". Systems need recalibration.'\e[0m" }
38
+ },
39
+ {
40
+ start: "\e[34mEpoch charges its engines: 'Time to break the barrier!'\e[0m",
41
+ finish: "\e[32mEpoch settles back into the timestream: 'Barrier broken. Ready for the next jump.'\e[0m",
42
+ failure: -> (error) { "\e[31mEpoch halts mid-flight, systems flickering: 'Temporal jump failed. Error: \"\e[35m#{error.message}\e[31m\". Recalibrating coordinates.'\e[0m" }
43
+ },
44
+ {
45
+ start: "\e[34mSchala’s voice echoes softly: 'The journey begins...'\e[0m",
46
+ finish: "\e[32mSchala’s voice fades gently: 'The task is complete. You’ve done well.'\e[0m",
47
+ failure: -> (error) { "\e[31mSchala’s voice trembles, filled with sorrow: 'The path is obstructed... Error: \"\e[35m#{error.message}\e[31m\". We must find another way.'\e[0m" }
48
+ },
49
+ {
50
+ start: "\e[34mThe gates of time shimmer: 'Opening the path to destiny...'\e[0m",
51
+ finish: "\e[32mThe gates of time close softly: 'The timeline is stable once more.'\e[0m",
52
+ failure: -> (error) { "\e[31mThe gates of time flicker violently: 'The path resists us. Error: \"\e[35m#{error.message}\e[31m\". The way remains sealed.'\e[0m" }
53
+ },
54
+ {
55
+ start: "\e[34mChrono leaps forward: 'The enemy will fall before me!'\e[0m",
56
+ finish: "\e[32mChrono stands victorious: 'The battle is won!'\e[0m",
57
+ failure: -> (error) { "\e[31mChrono stumbles back, exhausted: 'I’ve failed... Error: \"\e[35m#{error.message}\e[31m\". I must try again.'\e[0m" }
58
+ },
59
+ {
60
+ start: "\e[34mLucca adjusts the dials: 'Let’s see if this works!'\e[0m",
61
+ finish: "\e[32mLucca lets out a sigh of relief: 'It’s working. We’ve made it through.'\e[0m",
62
+ failure: -> (error) { "\e[31mLucca’s machine whirs and sputters: 'Something went wrong. Error: \"\e[35m#{error.message}\e[31m\". The system is failing.'\e[0m" }
63
+ },
64
+ {
65
+ start: "\e[34mMarle steadies herself: 'I won’t miss this time!'\e[0m",
66
+ finish: "\e[32mMarle celebrates: 'Bullseye! The target is down.'\e[0m",
67
+ failure: -> (error) { "\e[31mMarle curses under her breath: 'Not again! Error: \"\e[35m#{error.message}\e[31m\". I’ll need to re-aim.'\e[0m" }
68
+ },
69
+ {
70
+ start: "\e[34mFrog charges into battle: 'For the kingdom! For the honor!'\e[0m",
71
+ finish: "\e[32mFrog sheathes his sword: 'The mission is complete. Honor has been upheld.'\e[0m",
72
+ failure: -> (error) { "\e[31mFrog grips the Masamune tightly, his face somber: 'The mission was a failure. Error: \"\e[35m#{error.message}\e[31m\". We must regroup.'\e[0m" }
73
+ },
74
+ {
75
+ start: "\e[34mMagus conjures dark energy: 'Let the power of the darkness be unleashed!'\e[0m",
76
+ finish: "\e[32mMagus surveys the aftermath: 'The chaos has been contained... for now.'\e[0m",
77
+ failure: -> (error) { "\e[31mMagus clenches his fist in frustration: 'The power slipped through my grasp. Error: \"\e[35m#{error.message}\e[31m\". I must find another way.'\e[0m" }
78
+ },
79
+ {
80
+ start: "\e[34mAyla cracks her knuckles: 'Smash time!' \e[0m",
81
+ finish: "\e[32mAyla cheers: 'Smash complete! Me win again!'\e[0m",
82
+ failure: -> (error) { "\e[31mAyla looks disappointed: 'Smash no work. Error: \"\e[35m#{error.message}\e[31m\". Me need to try harder!'\e[0m" }
83
+ },
84
+ {
85
+ start: "\e[34mRobo activates his boosters: 'Systems online. Ready for action.'\e[0m",
86
+ finish: "\e[32mRobo reports: 'Mission complete. All systems stable.'\e[0m",
87
+ failure: -> (error) { "\e[31mRobo’s mechanical arm freezes in place: 'Error detected: \"\e[35m#{error.message}\e[31m\". Recalibrating.'\e[0m" }
88
+ },
89
+ {
90
+ start: "\e[34mEpoch charges its temporal engines: 'Navigating through time!'\e[0m",
91
+ finish: "\e[32mEpoch lands with a soft thud: 'Timeline verified. Jump successful.'\e[0m",
92
+ failure: -> (error) { "\e[31mEpoch jolts, systems crashing: 'Temporal disruption detected. Error: \"\e[35m#{error.message}\e[31m\". Initiating repair.'\e[0m" }
93
+ },
94
+ {
95
+ start: "\e[34mSchala prepares the spell: 'The moment is upon us.'\e[0m",
96
+ finish: "\e[32mSchala breathes out softly: 'The spell is cast. We are safe for now.'\e[0m",
97
+ failure: -> (error) { "\e[31mSchala’s energy flares out of control: 'The spell is incomplete. Error: \"\e[35m#{error.message}\e[31m\". We must start anew.'\e[0m" }
98
+ },
99
+ {
100
+ start: "\e[34mThe gates of time hum: 'Temporal doorways are opening.'\e[0m",
101
+ finish: "\e[32mThe gates close gently: 'The timeline is restored.'\e[0m",
102
+ failure: -> (error) { "\e[31mThe gates flicker and close rapidly: 'Error in time manipulation: \"\e[35m#{error.message}\e[31m\". Recalibration needed.'\e[0m" }
103
+ },
104
+ {
105
+ start: "\e[34mChrono draws his sword: 'I’ll fight for the future!'\e[0m",
106
+ finish: "\e[32mChrono wipes his brow: 'The fight is over. The world is safe.'\e[0m",
107
+ failure: -> (error) { "\e[31mChrono stumbles, sword dropping from his hand: 'The battle has been lost. Error: \"\e[35m#{error.message}\e[31m\". I must try again.'\e[0m" }
108
+ },
109
+ {
110
+ start: "\e[34mLucca adjusts her goggles: 'Let’s make history!'\e[0m",
111
+ finish: "\e[32mLucca exclaims: 'It worked! The past has been changed!'\e[0m",
112
+ failure: -> (error) { "\e[31mLucca slams her fist on the console: 'This wasn’t supposed to happen. Error: \"\e[35m#{error.message}\e[31m\". I need to reprogram.'\e[0m" }
113
+ },
114
+ {
115
+ start: "\e[34mMarle raises her bow: 'I’ll hit my target this time!'\e[0m",
116
+ finish: "\e[32mMarle cheers: 'Perfect shot! The mission is complete.'\e[0m",
117
+ failure: -> (error) { "\e[31mMarle frowns, frustrated: 'I missed! Error: \"\e[35m#{error.message}\e[31m\". I’ll try again.'\e[0m" }
118
+ },
119
+ {
120
+ start: "\e[34mFrog charges forward: 'For the kingdom!'\e[0m",
121
+ finish: "\e[32mFrog nods in approval: 'The battle has ended. We are victorious.'\e[0m",
122
+ failure: -> (error) { "\e[31mFrog’s Masamune falters: 'The kingdom is in danger... Error: \"\e[35m#{error.message}\e[31m\". We must try again.'\e[0m" }
123
+ }
124
+ ].sample
125
+ end
126
+
127
+ def self.next_trigger_quote(time)
128
+ time_string = time.strftime("%H:%M")
129
+ quotes =
130
+ [
131
+ "\e[33mThe clock ticks on... next trigger at #{time_string}.\e[0m",
132
+ "\e[33mThe timeline bends toward the next event at #{time_string}.\e[0m",
133
+ "\e[33mMarle smiles: 'We’re on course. Next action: #{time_string}.'\e[0m",
134
+ "\e[33mEpoch recalibrating—next stop: #{time_string}.\e[0m",
135
+ "\e[33mAyla grins: 'Me wait for #{time_string}. Then go smash event!'\e[0m",
136
+ "\e[33mThe gate glimmers faintly... next trigger at #{time_string}.\e[0m",
137
+ "\e[33mRobo scans the horizon: 'Next checkpoint: #{time_string}.'\e[0m",
138
+ "\e[33mMagus gazes into the distance: 'The moment comes... #{time_string} awaits.'\e[0m",
139
+ "\e[33mLucca checks her watch: 'Right on schedule for #{time_string}!'\e[0m",
140
+ "\e[33mThe winds of time carry whispers of the next event at #{time_string}.\e[0m",
141
+ "\e[33mFrog adjusts his armor: 'We shall be ready at #{time_string}.'\e[0m",
142
+ "\e[33mEpoch steadies itself in preparation for #{time_string}.\e[0m",
143
+ "\e[33mChrono silently waits for the perfect moment: #{time_string}.\e[0m",
144
+ "\e[33mThe pendulum swings... next destination: #{time_string}.\e[0m",
145
+ "\e[33mSchala’s voice hums faintly: 'The moment draws near... #{time_string}.'\e[0m",
146
+ "\e[33mRobo calculates: 'Timeline stable. Next event set for #{time_string}.'\e[0m",
147
+ "\e[33mMarle adjusts her bow: 'Almost time... #{time_string} is the moment.'\e[0m",
148
+ "\e[33mLucca tightens a bolt: 'Keep an eye out! #{time_string} is the target.'\e[0m",
149
+ "\e[33mMagus mutters: 'Soon... the plan aligns at #{time_string}.'\e[0m",
150
+ "\e[33mThe clock glows faintly, marking #{time_string} as the next divergence.\e[0m"
151
+ ]
152
+ quotes.sample
153
+ end
154
+
155
+ def self.sleep_quote
156
+ [
157
+ "The timeline is steady. Resting until the next ripple...",
158
+ "Robo hums a soft tune as the script waits for its next moment.",
159
+ "All is quiet... the gate awaits its next activation.",
160
+ "Magus mutters: 'Not yet. The time is not right...'",
161
+ "Ayla stretches: 'Nothing to do now. Wait for action!'",
162
+ "Epoch’s systems are idle, waiting for the stars to align.",
163
+ "Lucca adjusts some settings and nods: 'Still on track.'",
164
+ "Chrono sharpens his blade, preparing for the next event.",
165
+ "Marle gazes at the horizon, waiting for the call to action.",
166
+ "Frog meditates: 'Patience, for time is our ally...'",
167
+ "Schala whispers from the ether: 'It’s not time yet. Hold steady...'",
168
+ "The timeline flows undisturbed, waiting for its next divergence.",
169
+ "Robo blinks: 'Bzzt... monitoring systems operational.'",
170
+ "Epoch hovers silently, ready but at rest.",
171
+ "A subtle breeze flows through the timeline. All is calm for now.",
172
+ "The gate flickers faintly, but remains closed for now.",
173
+ "The past and future are quiet, as the present takes a breath.",
174
+ "A watchful eye on the clock... nothing stirs for the moment.",
175
+ "The winds of time settle as the next moment looms in the distance.",
176
+ "All is as it should be. Waiting for the call of the next adventure.",
177
+ "The echoes of time are silent. Resting in the void...",
178
+ "Magus closes his eyes briefly: 'The moment of action is yet to come.'",
179
+ "The clock gears turn softly... nothing stirs for now.",
180
+ "Frog sits by the fire, waiting for the call of duty.",
181
+ "Epoch hums faintly, idling in the fabric of time.",
182
+ "Lucca tinkers with her tools: 'Not yet... just a little longer.'",
183
+ "Chrono leans against his sword, eyes scanning the horizon.",
184
+ "The gate faintly shimmers but remains dormant for now.",
185
+ "Ayla yawns: 'Me wait. Me ready when time come!'",
186
+ "Marle adjusts her pendant, patiently watching over the timeline.",
187
+ "The winds of time rest quietly, awaiting their next stirring.",
188
+ "The stars above remain steady, as the timeline slumbers.",
189
+ "Robo’s sensors remain alert: 'Monitoring timeline integrity...'",
190
+ "Epoch stabilizes in the flow of time, drifting idly.",
191
+ "Schala’s voice whispers faintly: 'Peaceful moments are precious...'",
192
+ "Magus broods silently, his thoughts hidden as time stretches forward.",
193
+ "The waves of time settle into calm ripples, all is quiet.",
194
+ "Frog polishes his blade, awaiting the next challenge.",
195
+ "Lucca adjusts her goggles: 'Still holding. All systems normal.'",
196
+ "The pendulum swings gently, as the moment drifts closer.",
197
+ "Chrono sharpens his focus, ready for the next opening.",
198
+ "Marle hums softly: 'Not yet... but soon, I can feel it.'",
199
+ "Robo’s optics dim slightly, conserving power until the call to action.",
200
+ "Ayla looks to the horizon: 'Not time. But me ready when time come!'",
201
+ "The flow of time steadies itself, undisturbed for now.",
202
+ "Epoch idles, its systems purring softly in quiet anticipation.",
203
+ "Magus’ cape swirls as he ponders: 'Patience. Time bends to my will.'",
204
+ "A faint hum echoes as the script prepares for its next pulse of activity.",
205
+ "The gates remain sealed, their energy conserving for the right moment.",
206
+ "Robo: 'Bzzt... entering observation mode. Timeline remains stable.'"
207
+ ].sample
208
+ end
209
+ end
data/lib/time_egg.rb ADDED
@@ -0,0 +1,59 @@
1
+ require "time"
2
+ require "time_egg/characters_quotes"
3
+
4
+ class Integer
5
+ def minutes
6
+ self * 60
7
+ end
8
+
9
+ def hours
10
+ self * 3600
11
+ end
12
+
13
+ def days
14
+ self * 86400
15
+ end
16
+ end
17
+
18
+ class TimeEgg
19
+ attr_reader :trigger_frequency, :sleep_time
20
+
21
+ def initialize(trigger_frequency: 1.hour, sleep_time: 15.minutes)
22
+ raise ArgumentError "trigger_frequency can't be less than sleep_time" if trigger_frequency < sleep_time
23
+
24
+ raise ArgumentError "minimum sleep_time is 1 second" if sleep_time < 1
25
+
26
+ @trigger_frequency = trigger_frequency
27
+ @sleep_time = sleep_time
28
+ end
29
+
30
+ def timestamp
31
+ "#{Time.now.strftime("%H:%M:%S")}"
32
+ end
33
+
34
+ def trigger(&block)
35
+ trigger_time = Time.now
36
+ next_trigger_check = Time.now
37
+
38
+ while true
39
+ if Time.now >= trigger_time
40
+ begin
41
+ execution_quote = CharactersQuotes.execution_quotes
42
+ puts "#{timestamp}: #{execution_quote[:start]}"
43
+ block.call
44
+ puts "#{timestamp}: #{execution_quote[:finish]}"
45
+ rescue Exception => error
46
+ puts "#{timestamp}: #{execution_quote[:failure].(error)}"
47
+ ensure
48
+ trigger_time = Time.now + trigger_frequency
49
+ next_trigger_check = Time.now + sleep_time
50
+ puts "#{timestamp}: #{CharactersQuotes.next_trigger_quote(trigger_time)}"
51
+ end
52
+ elsif Time.now >= next_trigger_check
53
+ puts "#{timestamp}: #{CharactersQuotes.sleep_quote}"
54
+ next_trigger_check = Time.now + sleep_time
55
+ end
56
+ sleep(1)
57
+ end
58
+ end
59
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: time_egg
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Francisco das Chagas Jr
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-01-29 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Estabilishes a loop of time based triggered function block in the terminal
14
+ based on Chrono Trigger narrative events
15
+ email: francisco@fchagasjr.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/time_egg.rb
21
+ - lib/time_egg/characters_quotes.rb
22
+ homepage: https://github.com/fchagasjr/time_egg
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 3.3.26
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: CHRONOlogical TRIGGERed function block caller
45
+ test_files: []