Class: AWSCronParser::Parsers::AWSAt
- Defined in:
- lib/aws_cron_parser/parsers/aws_at.rb
Overview
AWS one-time schedule: at(yyyy-MM-ddThh:mm:ss). Fires exactly once.
Instance Attribute Summary collapse
-
#at ⇒ Object
readonly
Returns the value of attribute at.
Attributes inherited from Base
#original_source, #source, #time_source, #time_zone
Instance Method Summary collapse
-
#initialize(source, time_source = Time) ⇒ AWSAt
constructor
A new instance of AWSAt.
-
#next(now = @time_source.now) ⇒ Object
nil once the instant has passed: a one-time schedule has no further runs.
Methods inherited from Base
Methods included from Helpers
Constructor Details
#initialize(source, time_source = Time) ⇒ AWSAt
Returns a new instance of AWSAt.
9 10 11 12 13 14 15 16 |
# File 'lib/aws_cron_parser/parsers/aws_at.rb', line 9 def initialize(source, time_source = Time) super match = source.strip.match(AT_REGEX) raise ArgumentError, "Invalid at format: #{source}" unless match @at = zone.parse(match[:datetime].strip) end |
Instance Attribute Details
#at ⇒ Object (readonly)
Returns the value of attribute at.
7 8 9 |
# File 'lib/aws_cron_parser/parsers/aws_at.rb', line 7 def at @at end |
Instance Method Details
#next(now = @time_source.now) ⇒ Object
nil once the instant has passed: a one-time schedule has no further runs.
19 20 21 |
# File 'lib/aws_cron_parser/parsers/aws_at.rb', line 19 def next(now = @time_source.now) @at > ensure_time(now) ? @at : nil end |