Class: Jira::Auto::Tool::UntilDate

Inherits:
Object
  • Object
show all
Defined in:
lib/jira/auto/tool/until_date.rb

Defined Under Namespace

Classes: FormatError

Constant Summary collapse

NAMED_DATES =
i[
  today
  current_quarter
  coming_quarter
].freeze
NAMED_DATE_REGEX =
/^(#{NAMED_DATES.join("|")})$/
INCLUDES_TIME_REGEX =
/.+\s\d{2}:\d{2}.+/
STARTS_WITH_DATE_REGEX =

TODO : use something more reliable like the Chronic gem

/^\d{4}-\d{2}-\d{2}$/
TIME_UNTIL_MIDNIGHT_UTC =
" 23:59:59 UTC"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(date_string) ⇒ UntilDate

Returns a new instance of UntilDate.



27
28
29
30
31
32
33
34
35
# File 'lib/jira/auto/tool/until_date.rb', line 27

def initialize(date_string)
  @time =
    case date_string
    when NAMED_DATE_REGEX
      send(date_string.intern)
    else
      parse_date(date_string)
    end
end

Instance Attribute Details

#timeObject (readonly)

Returns the value of attribute time.



13
14
15
# File 'lib/jira/auto/tool/until_date.rb', line 13

def time
  @time
end

Instance Method Details

#current_date_timeObject



37
38
39
# File 'lib/jira/auto/tool/until_date.rb', line 37

def current_date_time
  Helpers::OverridableTime.now.utc
end