Class: AWSCronParser::Describer::DayComposer
- Inherits:
-
Object
- Object
- AWSCronParser::Describer::DayComposer
- Includes:
- Helpers
- Defined in:
- lib/aws_cron_parser/describer/day_composer.rb
Overview
Composes day descriptions (day-of-month and day-of-week)
Instance Attribute Summary collapse
-
#day ⇒ Object
readonly
Returns the value of attribute day.
-
#dow ⇒ Object
readonly
Returns the value of attribute dow.
-
#is_aws ⇒ Object
readonly
Returns the value of attribute is_aws.
Instance Method Summary collapse
- #compose ⇒ Object
-
#initialize(config, is_aws: false) ⇒ DayComposer
constructor
A new instance of DayComposer.
Methods included from Helpers
Constructor Details
#initialize(config, is_aws: false) ⇒ DayComposer
Returns a new instance of DayComposer.
11 12 13 14 15 |
# File 'lib/aws_cron_parser/describer/day_composer.rb', line 11 def initialize(config, is_aws: false) @day = config[:day] @dow = config[:dow] @is_aws = is_aws end |
Instance Attribute Details
#day ⇒ Object (readonly)
Returns the value of attribute day.
9 10 11 |
# File 'lib/aws_cron_parser/describer/day_composer.rb', line 9 def day @day end |
#dow ⇒ Object (readonly)
Returns the value of attribute dow.
9 10 11 |
# File 'lib/aws_cron_parser/describer/day_composer.rb', line 9 def dow @dow end |
#is_aws ⇒ Object (readonly)
Returns the value of attribute is_aws.
9 10 11 |
# File 'lib/aws_cron_parser/describer/day_composer.rb', line 9 def is_aws @is_aws end |
Instance Method Details
#compose ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/aws_cron_parser/describer/day_composer.rb', line 17 def compose day_wildcard = wildcards?(day) dow_wildcard = wildcards?(dow) # Both wildcards - no day description return nil if day_wildcard && dow_wildcard # Only day-of-week return describe_dow if day_wildcard && !dow_wildcard # Only day-of-month return describe_day if !day_wildcard && dow_wildcard # Both specified (AWS allows this for OR logic) describe_both end |