Class: WebpageUpdateChecker::Methods::LastModified

Inherits:
Object
  • Object
show all
Defined in:
lib/webpage_update_checker/methods/last_modified.rb

Instance Method Summary collapse

Constructor Details

#initialize(uri:) ⇒ LastModified

Returns a new instance of LastModified.



7
8
9
# File 'lib/webpage_update_checker/methods/last_modified.rb', line 7

def initialize(uri:)
  @uri = uri
end

Instance Method Details

#current_comparison_valueObject



11
12
13
14
# File 'lib/webpage_update_checker/methods/last_modified.rb', line 11

def current_comparison_value
  page = Mechanize.new.get(@uri)
  page.header['last-modified'] ? Time.parse(page.header['last-modified']) : nil
end