Class: Gitlab::Ci::Build::Artifacts::ExpireInParser

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/build/artifacts/expire_in_parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ ExpireInParser

Returns a new instance of ExpireInParser.


12
13
14
# File 'lib/gitlab/ci/build/artifacts/expire_in_parser.rb', line 12

def initialize(value)
  @value = value
end

Class Method Details

.validate_duration(value) ⇒ Object


8
9
10
# File 'lib/gitlab/ci/build/artifacts/expire_in_parser.rb', line 8

def self.validate_duration(value)
  new(value).validate_duration
end

Instance Method Details

#seconds_from_nowObject


24
25
26
# File 'lib/gitlab/ci/build/artifacts/expire_in_parser.rb', line 24

def seconds_from_now
  parse&.seconds&.from_now
end

#validate_durationObject


16
17
18
19
20
21
22
# File 'lib/gitlab/ci/build/artifacts/expire_in_parser.rb', line 16

def validate_duration
  return true if never?

  parse
rescue ChronicDuration::DurationParseError
  false
end