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.



587
588
589
590
591
592
593
594
595
596
597
598
# File 'lib/temporalio/client/schedule.rb', line 587

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?



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/temporalio/client/schedule.rb', line 562

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>



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/temporalio/client/schedule.rb', line 562

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>



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/temporalio/client/schedule.rb', line 562

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>



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/temporalio/client/schedule.rb', line 562

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>



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/temporalio/client/schedule.rb', line 562

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>



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/temporalio/client/schedule.rb', line 562

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>



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/temporalio/client/schedule.rb', line 562

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>



562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/temporalio/client/schedule.rb', line 562

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