Class: LinksUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/links_updater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLinksUpdater

Returns a new instance of LinksUpdater.



4
5
6
7
# File 'lib/links_updater.rb', line 4

def initialize
  @timestamp_file_path = File.expand_path("../assets/last_updated.txt", File.dirname(__FILE__))
  @links_file_path = File.expand_path("../assets/lists.js", File.dirname(__FILE__))
end

Instance Attribute Details

Returns the value of attribute links_file_path.



2
3
4
# File 'lib/links_updater.rb', line 2

def links_file_path
  @links_file_path
end

#timestamp_file_pathObject (readonly)

Returns the value of attribute timestamp_file_path.



2
3
4
# File 'lib/links_updater.rb', line 2

def timestamp_file_path
  @timestamp_file_path
end

Instance Method Details



9
10
11
12
13
14
# File 'lib/links_updater.rb', line 9

def update_links_if_needed
  if is_time_to_update?
    update_links_from_website
    update_timestamp
  end
end