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

Inherits:
Object
  • Object
show all
Defined in:
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.



555
556
557
558
559
560
561
562
563
564
565
566
# File 'lib/temporalio/client/schedule.rb', line 555

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.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/temporalio/client/schedule.rb', line 530

class Calendar
  # @!visibility private
  def self._from_proto(raw_cal)
    Calendar.new(
      second: Range._from_protos(raw_cal.second),
      minute: Range._from_protos(raw_cal.minute),
      hour: Range._from_protos(raw_cal.hour),
      day_of_month: Range._from_protos(raw_cal.day_of_month),
      month: Range._from_protos(raw_cal.month),
      year: Range._from_protos(raw_cal.year),
      day_of_week: Range._from_protos(raw_cal.day_of_week),
      comment: Internal::ProtoUtils.string_or(raw_cal.comment)
    )
  end

  # Create a calendar spec.
  #
  # @param second [Array<Range>] Second range to match, 0-59. Default matches 0.
  # @param minute [Array<Range>] Minute range to match, 0-59. Default matches 0.
  # @param hour [Array<Range>] Hour range to match, 0-23. Default matches 0.
  # @param day_of_month [Array<Range>] Day of month range to match, 1-31. Default matches all days.
  # @param month [Array<Range>] Month range to match, 1-12. Default matches all months.
  # @param year [Array<Range>] Optional year range to match. Default of empty matches all years.
  # @param day_of_week [Array<Range>] Day of week range to match, 0-6, 0 is Sunday. Default matches all days.
  # @param comment [String, nil] Description of this schedule.
  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

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::StructuredCalendarSpec.new(
      second: Range._to_protos(second),
      minute: Range._to_protos(minute),
      hour: Range._to_protos(hour),
      day_of_month: Range._to_protos(day_of_month),
      month: Range._to_protos(month),
      year: Range._to_protos(year),
      day_of_week: Range._to_protos(day_of_week),
      comment: comment || ''
    )
  end
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.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/temporalio/client/schedule.rb', line 530

class Calendar
  # @!visibility private
  def self._from_proto(raw_cal)
    Calendar.new(
      second: Range._from_protos(raw_cal.second),
      minute: Range._from_protos(raw_cal.minute),
      hour: Range._from_protos(raw_cal.hour),
      day_of_month: Range._from_protos(raw_cal.day_of_month),
      month: Range._from_protos(raw_cal.month),
      year: Range._from_protos(raw_cal.year),
      day_of_week: Range._from_protos(raw_cal.day_of_week),
      comment: Internal::ProtoUtils.string_or(raw_cal.comment)
    )
  end

  # Create a calendar spec.
  #
  # @param second [Array<Range>] Second range to match, 0-59. Default matches 0.
  # @param minute [Array<Range>] Minute range to match, 0-59. Default matches 0.
  # @param hour [Array<Range>] Hour range to match, 0-23. Default matches 0.
  # @param day_of_month [Array<Range>] Day of month range to match, 1-31. Default matches all days.
  # @param month [Array<Range>] Month range to match, 1-12. Default matches all months.
  # @param year [Array<Range>] Optional year range to match. Default of empty matches all years.
  # @param day_of_week [Array<Range>] Day of week range to match, 0-6, 0 is Sunday. Default matches all days.
  # @param comment [String, nil] Description of this schedule.
  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

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::StructuredCalendarSpec.new(
      second: Range._to_protos(second),
      minute: Range._to_protos(minute),
      hour: Range._to_protos(hour),
      day_of_month: Range._to_protos(day_of_month),
      month: Range._to_protos(month),
      year: Range._to_protos(year),
      day_of_week: Range._to_protos(day_of_week),
      comment: comment || ''
    )
  end
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.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/temporalio/client/schedule.rb', line 530

class Calendar
  # @!visibility private
  def self._from_proto(raw_cal)
    Calendar.new(
      second: Range._from_protos(raw_cal.second),
      minute: Range._from_protos(raw_cal.minute),
      hour: Range._from_protos(raw_cal.hour),
      day_of_month: Range._from_protos(raw_cal.day_of_month),
      month: Range._from_protos(raw_cal.month),
      year: Range._from_protos(raw_cal.year),
      day_of_week: Range._from_protos(raw_cal.day_of_week),
      comment: Internal::ProtoUtils.string_or(raw_cal.comment)
    )
  end

  # Create a calendar spec.
  #
  # @param second [Array<Range>] Second range to match, 0-59. Default matches 0.
  # @param minute [Array<Range>] Minute range to match, 0-59. Default matches 0.
  # @param hour [Array<Range>] Hour range to match, 0-23. Default matches 0.
  # @param day_of_month [Array<Range>] Day of month range to match, 1-31. Default matches all days.
  # @param month [Array<Range>] Month range to match, 1-12. Default matches all months.
  # @param year [Array<Range>] Optional year range to match. Default of empty matches all years.
  # @param day_of_week [Array<Range>] Day of week range to match, 0-6, 0 is Sunday. Default matches all days.
  # @param comment [String, nil] Description of this schedule.
  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

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::StructuredCalendarSpec.new(
      second: Range._to_protos(second),
      minute: Range._to_protos(minute),
      hour: Range._to_protos(hour),
      day_of_month: Range._to_protos(day_of_month),
      month: Range._to_protos(month),
      year: Range._to_protos(year),
      day_of_week: Range._to_protos(day_of_week),
      comment: comment || ''
    )
  end
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.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/temporalio/client/schedule.rb', line 530

class Calendar
  # @!visibility private
  def self._from_proto(raw_cal)
    Calendar.new(
      second: Range._from_protos(raw_cal.second),
      minute: Range._from_protos(raw_cal.minute),
      hour: Range._from_protos(raw_cal.hour),
      day_of_month: Range._from_protos(raw_cal.day_of_month),
      month: Range._from_protos(raw_cal.month),
      year: Range._from_protos(raw_cal.year),
      day_of_week: Range._from_protos(raw_cal.day_of_week),
      comment: Internal::ProtoUtils.string_or(raw_cal.comment)
    )
  end

  # Create a calendar spec.
  #
  # @param second [Array<Range>] Second range to match, 0-59. Default matches 0.
  # @param minute [Array<Range>] Minute range to match, 0-59. Default matches 0.
  # @param hour [Array<Range>] Hour range to match, 0-23. Default matches 0.
  # @param day_of_month [Array<Range>] Day of month range to match, 1-31. Default matches all days.
  # @param month [Array<Range>] Month range to match, 1-12. Default matches all months.
  # @param year [Array<Range>] Optional year range to match. Default of empty matches all years.
  # @param day_of_week [Array<Range>] Day of week range to match, 0-6, 0 is Sunday. Default matches all days.
  # @param comment [String, nil] Description of this schedule.
  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

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::StructuredCalendarSpec.new(
      second: Range._to_protos(second),
      minute: Range._to_protos(minute),
      hour: Range._to_protos(hour),
      day_of_month: Range._to_protos(day_of_month),
      month: Range._to_protos(month),
      year: Range._to_protos(year),
      day_of_week: Range._to_protos(day_of_week),
      comment: comment || ''
    )
  end
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.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/temporalio/client/schedule.rb', line 530

class Calendar
  # @!visibility private
  def self._from_proto(raw_cal)
    Calendar.new(
      second: Range._from_protos(raw_cal.second),
      minute: Range._from_protos(raw_cal.minute),
      hour: Range._from_protos(raw_cal.hour),
      day_of_month: Range._from_protos(raw_cal.day_of_month),
      month: Range._from_protos(raw_cal.month),
      year: Range._from_protos(raw_cal.year),
      day_of_week: Range._from_protos(raw_cal.day_of_week),
      comment: Internal::ProtoUtils.string_or(raw_cal.comment)
    )
  end

  # Create a calendar spec.
  #
  # @param second [Array<Range>] Second range to match, 0-59. Default matches 0.
  # @param minute [Array<Range>] Minute range to match, 0-59. Default matches 0.
  # @param hour [Array<Range>] Hour range to match, 0-23. Default matches 0.
  # @param day_of_month [Array<Range>] Day of month range to match, 1-31. Default matches all days.
  # @param month [Array<Range>] Month range to match, 1-12. Default matches all months.
  # @param year [Array<Range>] Optional year range to match. Default of empty matches all years.
  # @param day_of_week [Array<Range>] Day of week range to match, 0-6, 0 is Sunday. Default matches all days.
  # @param comment [String, nil] Description of this schedule.
  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

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::StructuredCalendarSpec.new(
      second: Range._to_protos(second),
      minute: Range._to_protos(minute),
      hour: Range._to_protos(hour),
      day_of_month: Range._to_protos(day_of_month),
      month: Range._to_protos(month),
      year: Range._to_protos(year),
      day_of_week: Range._to_protos(day_of_week),
      comment: comment || ''
    )
  end
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.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/temporalio/client/schedule.rb', line 530

class Calendar
  # @!visibility private
  def self._from_proto(raw_cal)
    Calendar.new(
      second: Range._from_protos(raw_cal.second),
      minute: Range._from_protos(raw_cal.minute),
      hour: Range._from_protos(raw_cal.hour),
      day_of_month: Range._from_protos(raw_cal.day_of_month),
      month: Range._from_protos(raw_cal.month),
      year: Range._from_protos(raw_cal.year),
      day_of_week: Range._from_protos(raw_cal.day_of_week),
      comment: Internal::ProtoUtils.string_or(raw_cal.comment)
    )
  end

  # Create a calendar spec.
  #
  # @param second [Array<Range>] Second range to match, 0-59. Default matches 0.
  # @param minute [Array<Range>] Minute range to match, 0-59. Default matches 0.
  # @param hour [Array<Range>] Hour range to match, 0-23. Default matches 0.
  # @param day_of_month [Array<Range>] Day of month range to match, 1-31. Default matches all days.
  # @param month [Array<Range>] Month range to match, 1-12. Default matches all months.
  # @param year [Array<Range>] Optional year range to match. Default of empty matches all years.
  # @param day_of_week [Array<Range>] Day of week range to match, 0-6, 0 is Sunday. Default matches all days.
  # @param comment [String, nil] Description of this schedule.
  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

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::StructuredCalendarSpec.new(
      second: Range._to_protos(second),
      minute: Range._to_protos(minute),
      hour: Range._to_protos(hour),
      day_of_month: Range._to_protos(day_of_month),
      month: Range._to_protos(month),
      year: Range._to_protos(year),
      day_of_week: Range._to_protos(day_of_week),
      comment: comment || ''
    )
  end
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.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/temporalio/client/schedule.rb', line 530

class Calendar
  # @!visibility private
  def self._from_proto(raw_cal)
    Calendar.new(
      second: Range._from_protos(raw_cal.second),
      minute: Range._from_protos(raw_cal.minute),
      hour: Range._from_protos(raw_cal.hour),
      day_of_month: Range._from_protos(raw_cal.day_of_month),
      month: Range._from_protos(raw_cal.month),
      year: Range._from_protos(raw_cal.year),
      day_of_week: Range._from_protos(raw_cal.day_of_week),
      comment: Internal::ProtoUtils.string_or(raw_cal.comment)
    )
  end

  # Create a calendar spec.
  #
  # @param second [Array<Range>] Second range to match, 0-59. Default matches 0.
  # @param minute [Array<Range>] Minute range to match, 0-59. Default matches 0.
  # @param hour [Array<Range>] Hour range to match, 0-23. Default matches 0.
  # @param day_of_month [Array<Range>] Day of month range to match, 1-31. Default matches all days.
  # @param month [Array<Range>] Month range to match, 1-12. Default matches all months.
  # @param year [Array<Range>] Optional year range to match. Default of empty matches all years.
  # @param day_of_week [Array<Range>] Day of week range to match, 0-6, 0 is Sunday. Default matches all days.
  # @param comment [String, nil] Description of this schedule.
  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

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::StructuredCalendarSpec.new(
      second: Range._to_protos(second),
      minute: Range._to_protos(minute),
      hour: Range._to_protos(hour),
      day_of_month: Range._to_protos(day_of_month),
      month: Range._to_protos(month),
      year: Range._to_protos(year),
      day_of_week: Range._to_protos(day_of_week),
      comment: comment || ''
    )
  end
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.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
# File 'lib/temporalio/client/schedule.rb', line 530

class Calendar
  # @!visibility private
  def self._from_proto(raw_cal)
    Calendar.new(
      second: Range._from_protos(raw_cal.second),
      minute: Range._from_protos(raw_cal.minute),
      hour: Range._from_protos(raw_cal.hour),
      day_of_month: Range._from_protos(raw_cal.day_of_month),
      month: Range._from_protos(raw_cal.month),
      year: Range._from_protos(raw_cal.year),
      day_of_week: Range._from_protos(raw_cal.day_of_week),
      comment: Internal::ProtoUtils.string_or(raw_cal.comment)
    )
  end

  # Create a calendar spec.
  #
  # @param second [Array<Range>] Second range to match, 0-59. Default matches 0.
  # @param minute [Array<Range>] Minute range to match, 0-59. Default matches 0.
  # @param hour [Array<Range>] Hour range to match, 0-23. Default matches 0.
  # @param day_of_month [Array<Range>] Day of month range to match, 1-31. Default matches all days.
  # @param month [Array<Range>] Month range to match, 1-12. Default matches all months.
  # @param year [Array<Range>] Optional year range to match. Default of empty matches all years.
  # @param day_of_week [Array<Range>] Day of week range to match, 0-6, 0 is Sunday. Default matches all days.
  # @param comment [String, nil] Description of this schedule.
  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

  # @!visibility private
  def _to_proto
    Api::Schedule::V1::StructuredCalendarSpec.new(
      second: Range._to_protos(second),
      minute: Range._to_protos(minute),
      hour: Range._to_protos(hour),
      day_of_month: Range._to_protos(day_of_month),
      month: Range._to_protos(month),
      year: Range._to_protos(year),
      day_of_week: Range._to_protos(day_of_week),
      comment: comment || ''
    )
  end
end