Top Level Namespace
Defined Under Namespace
Modules: OAI
Instance Method Summary collapse
Instance Method Details
#harvestable_sites(conf) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/oai/harvester.rb', line 23 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
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/oai/harvester.rb', line 31 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 |