Method: WebStat::Fetch#get_last_modified

Defined in:
lib/web_stat/fetch.rb

#get_last_modifiedObject

Return Date or last modified header.

Parameters:

  • url (String)

Returns:

  • DataTime



140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/web_stat/fetch.rb', line 140

def get_last_modified
  @header = @header || {}
  if @header.has_key?("date") && @header.has_key?("last-modified")
    if DateTime.parse(@header["date"]) >= DateTime.parse(@header["last-modified"])
      DateTime.parse(@header["date"])
    else
      DateTime.parse(@header["last-modified"])
    end
  elsif @header.has_key?("date")
    DateTime.parse(@header["date"])
  elsif @header.has_key?("last-modified")
    DateTime.parse(@header["last-modified"])
  end
end