Class: HermesAgent::Client::Entities::JobSchedule
- Inherits:
-
HermesAgent::Client::Entity
- Object
- HermesAgent::Client::Entity
- HermesAgent::Client::Entities::JobSchedule
- Defined in:
- lib/hermes_agent/client/entities/job.rb
Overview
The schedule of a Job (HermesAgent::Client::Entities::Job#schedule): a tagged union discriminated by
#kind. The create/update schedule string is parsed server-side into
one of three kinds, each carrying its own payload:
"once"— a one-shot run at #run_at (an ISO-8601 string)."interval"— a recurring run every #minutes minutes."cron"— a recurring run on the cron expression #expr.
Use the #once? / #interval? / #cron? predicates to discriminate.
The payload readers (#run_at / #minutes / #expr) return nil when
the schedule is not of their kind. #display is a human-readable form of
the schedule for any kind. Field readers are best-effort; HermesAgent::Client::Entity#to_h remains
the source of truth.
Instance Method Summary collapse
-
#cron? ⇒ boolean
Whether this is a recurring cron (
"cron") schedule. -
#display ⇒ String?
A human-readable rendering of the schedule (e.g.
"every 120m","0 9 * * *", or"once at 2027-02-03 14:00"). -
#expr ⇒ String?
The cron expression of a
"cron"schedule. -
#interval? ⇒ boolean
Whether this is a recurring interval (
"interval") schedule. -
#kind ⇒ String?
The schedule kind:
"once","interval", or"cron". -
#minutes ⇒ Integer?
The interval in minutes of an
"interval"schedule. -
#once? ⇒ boolean
Whether this is a one-shot (
"once") schedule. -
#run_at ⇒ String?
The scheduled run time of a
"once"schedule, as an ISO-8601 string.
Methods inherited from HermesAgent::Client::Entity
Instance Method Details
#cron? ⇒ boolean
Whether this is a recurring cron ("cron") schedule.
76 77 78 |
# File 'lib/hermes_agent/client/entities/job.rb', line 76 def cron? kind == "cron" end |
#display ⇒ String?
A human-readable rendering of the schedule (e.g. "every 120m",
"0 9 * * *", or "once at 2027-02-03 14:00").
85 86 87 |
# File 'lib/hermes_agent/client/entities/job.rb', line 85 def display self["display"] end |
#expr ⇒ String?
The cron expression of a "cron" schedule. Returns nil when the
schedule is not of kind "cron".
112 113 114 |
# File 'lib/hermes_agent/client/entities/job.rb', line 112 def expr self["expr"] end |
#interval? ⇒ boolean
Whether this is a recurring interval ("interval") schedule.
68 69 70 |
# File 'lib/hermes_agent/client/entities/job.rb', line 68 def interval? kind == "interval" end |
#kind ⇒ String?
The schedule kind: "once", "interval", or "cron".
52 53 54 |
# File 'lib/hermes_agent/client/entities/job.rb', line 52 def kind self["kind"] end |
#minutes ⇒ Integer?
The interval in minutes of an "interval" schedule. Returns nil when
the schedule is not of kind "interval".
103 104 105 |
# File 'lib/hermes_agent/client/entities/job.rb', line 103 def minutes self["minutes"] end |
#once? ⇒ boolean
Whether this is a one-shot ("once") schedule.
60 61 62 |
# File 'lib/hermes_agent/client/entities/job.rb', line 60 def once? kind == "once" end |
#run_at ⇒ String?
The scheduled run time of a "once" schedule, as an ISO-8601 string.
Returns nil when the schedule is not of kind "once".
94 95 96 |
# File 'lib/hermes_agent/client/entities/job.rb', line 94 def run_at self["run_at"] end |