Class: Rpush::Daemon::RetryHeaderParser

Inherits:
Object
  • Object
show all
Defined in:
lib/rpush/daemon/retry_header_parser.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header) ⇒ RetryHeaderParser

Returns a new instance of RetryHeaderParser.



8
9
10
# File 'lib/rpush/daemon/retry_header_parser.rb', line 8

def initialize(header)
  @header = header
end

Class Method Details

.parse(header) ⇒ Object



4
5
6
# File 'lib/rpush/daemon/retry_header_parser.rb', line 4

def self.parse(header)
  new(header).parse
end

Instance Method Details

#parseObject



12
13
14
15
16
17
18
19
20
# File 'lib/rpush/daemon/retry_header_parser.rb', line 12

def parse
  return unless @header

  if @header.to_s =~ /^[0-9]+$/
    Time.now + @header.to_i
  else
    Time.httpdate(@header)
  end
end