Class: Temporalio::Client::Schedule::Spec::Calendar

Inherits:
Data
  • Object
show all
Defined in:
lib/temporalio/client/schedule.rb,
lib/temporalio/client/schedule.rb

Overview

Specification relative to calendar time when to run an action.

A timestamp matches if at least one range of each field matches except for year. If year is missing, that means all years match. For all fields besides year, at least one range must be present to match anything.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(second: [Range.new(0)], minute: [Range.new(0)], hour: [Range.new(0)], day_of_month: [Range.new(1, 31)], month: [Range.new(1, 12)], year: [], day_of_week: [Range.new(0, 6)], comment: nil) ⇒ Calendar

Create a calendar spec.

Parameters:

  • second (Array<Range>) (defaults to: [Range.new(0)])

    Second range to match, 0-59. Default matches 0.

  • minute (Array<Range>) (defaults to: [Range.new(0)])

    Minute range to match, 0-59. Default matches 0.

  • hour (Array<Range>) (defaults to: [Range.new(0)])

    Hour range to match, 0-23. Default matches 0.

  • day_of_month (Array<Range>) (defaults to: [Range.new(1, 31)])

    Day of month range to match, 1-31. Default matches all days.

  • month (Array<Range>) (defaults to: [Range.new(1, 12)])

    Month range to match, 1-12. Default matches all months.

  • year (Array<Range>) (defaults to: [])

    Optional year range to match. Default of empty matches all years.

  • day_of_week (Array<Range>) (defaults to: [Range.new(0, 6)])

    Day of week range to match, 0-6, 0 is Sunday. Default matches all days.

  • comment (String, nil) (defaults to: nil)

    Description of this schedule.



595
596
597
598
599
600
601
602
603
604
605
606
# File 'lib/temporalio/client/schedule.rb', line 595

def initialize(
  second: [Range.new(0)],
  minute: [Range.new(0)],
  hour: [Range.new(0)],
  day_of_month: [Range.new(1, 31)],
  month: [Range.new(1, 12)],
  year: [],
  day_of_week: [Range.new(0, 6)],
  comment: nil
)
  super
end

Instance Attribute Details

#commentString?

Returns Description of this schedule.

Returns:

  • (String, nil)

    Description of this schedule.



538
539
540
# File 'lib/temporalio/client/schedule.rb', line 538

def comment
  @comment
end

#day_of_monthArray<Range>

Returns Day of month range to match, 1-31. Default matches all days.

Returns:

  • (Array<Range>)

    Day of month range to match, 1-31. Default matches all days.



538
539
540
# File 'lib/temporalio/client/schedule.rb', line 538

def day_of_month
  @day_of_month
end

#day_of_weekArray<Range>

Returns Day of week range to match, 0-6, 0 is Sunday. Default matches all days.

Returns:

  • (Array<Range>)

    Day of week range to match, 0-6, 0 is Sunday. Default matches all days.



538
539
540
# File 'lib/temporalio/client/schedule.rb', line 538

def day_of_week
  @day_of_week
end

#hourArray<Range>

Returns Hour range to match, 0-23. Default matches 0.

Returns:

  • (Array<Range>)

    Hour range to match, 0-23. Default matches 0.



538
539
540
# File 'lib/temporalio/client/schedule.rb', line 538

def hour
  @hour
end

#minuteArray<Range>

Returns Minute range to match, 0-59. Default matches 0.

Returns:

  • (Array<Range>)

    Minute range to match, 0-59. Default matches 0.



538
539
540
# File 'lib/temporalio/client/schedule.rb', line 538

def minute
  @minute
end

#monthArray<Range>

Returns Month range to match, 1-12. Default matches all months.

Returns:

  • (Array<Range>)

    Month range to match, 1-12. Default matches all months.



538
539
540
# File 'lib/temporalio/client/schedule.rb', line 538

def month
  @month
end

#secondArray<Range>

Returns Second range to match, 0-59. Default matches 0.

Returns:

  • (Array<Range>)

    Second range to match, 0-59. Default matches 0.



538
539
540
# File 'lib/temporalio/client/schedule.rb', line 538

def second
  @second
end

#yearArray<Range>

Returns Optional year range to match. Default of empty matches all years.

Returns:

  • (Array<Range>)

    Optional year range to match. Default of empty matches all years.



538
539
540
# File 'lib/temporalio/client/schedule.rb', line 538

def year
  @year
end