Class: AWSCronParser::Describer::TimeComposer

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/aws_cron_parser/describer/time_composer.rb

Overview

Composes time descriptions (second, minute, hour)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

included

Constructor Details

#initialize(config, is_aws: false) ⇒ TimeComposer

Returns a new instance of TimeComposer.



11
12
13
14
15
16
# File 'lib/aws_cron_parser/describer/time_composer.rb', line 11

def initialize(config, is_aws: false)
  @second = config[:second]
  @minute = config[:minute]
  @hour = config[:hour]
  @is_aws = is_aws
end

Instance Attribute Details

#hourObject (readonly)

Returns the value of attribute hour.



9
10
11
# File 'lib/aws_cron_parser/describer/time_composer.rb', line 9

def hour
  @hour
end

#is_awsObject (readonly)

Returns the value of attribute is_aws.



9
10
11
# File 'lib/aws_cron_parser/describer/time_composer.rb', line 9

def is_aws
  @is_aws
end

#minuteObject (readonly)

Returns the value of attribute minute.



9
10
11
# File 'lib/aws_cron_parser/describer/time_composer.rb', line 9

def minute
  @minute
end

#secondObject (readonly)

Returns the value of attribute second.



9
10
11
# File 'lib/aws_cron_parser/describer/time_composer.rb', line 9

def second
  @second
end

Instance Method Details

#composeObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/aws_cron_parser/describer/time_composer.rb', line 18

def compose
  return nil if all_wildcards?

  # Try specific patterns first
  return describe_specific_time if specific_time?
  return describe_step_pattern if step_pattern?
  return describe_specific_second if specific_second_pattern?

  # General composition
  describe_general
end