Top Level Namespace
Defined Under Namespace
Modules: OAI
Instance Method Summary collapse
Instance Method Details
#harvestable_sites(conf) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/oai/harvester.rb', line 19 def harvestable_sites(conf) sites = [] conf.sites.each do |k, v| sites << k if needs_updating(v['period'], v['last']) end if conf.sites sites end |
#needs_updating(period, last) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/oai/harvester.rb', line 27 def needs_updating(period, last) return true if last.nil? case period when 'daily' return true if Time.now - last > 86000 when 'weekly' return true if Time.now - last > 604000 when 'monthly' return true if Time.now - last > 2591000 end return false end |