class Pipely::PipelineDateTime::PipelineDate

Encapsulates AWS pipeline date

Constants

DEFAULT_DAY_FORMAT
DEFAULT_MONTH_FORMAT
DEFAULT_YEAR_FORMAT

Public Class Methods

day_format() click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 16
def day_format
  @day_format || DEFAULT_DAY_FORMAT
end
day_format=(day_format) click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 12
def day_format=(day_format)
  @day_format = day_format
end
month_format() click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 24
def month_format
  @month_format || DEFAULT_MONTH_FORMAT
end
month_format=(month_format) click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 20
def month_format=(month_format)
  @month_format = month_format
end
new(target_date, days_back) click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 37
def initialize(target_date, days_back)
  days_back = days_back.to_i
  @date_expression = case
                     when days_back > 0
                       "minusDays(#{target_date}, #{days_back})"
                     when days_back == 0
                       target_date
                     else
                       "plusDays(#{target_date}, #{-days_back})"
                     end
end
year_format() click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 32
def year_format
  @year_format || DEFAULT_YEAR_FORMAT
end
year_format=(year_format) click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 28
def year_format=(year_format)
  @year_format = year_format
end

Public Instance Methods

day() click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 49
def day
  "\#{format(#{@date_expression}, \"#{PipelineDate.day_format}\")}"
end
month() click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 53
def month
  "\#{format(#{@date_expression}, "\
    "\"#{PipelineDate.month_format}\")}/[0-9]+"
end
year() click to toggle source
# File lib/pipely/pipeline_date_time/pipeline_date.rb, line 58
def year
  "\#{format(#{@date_expression}, "\
    "\"#{PipelineDate.year_format}\")}/[0-9]+/[0-9]+"
end