Class: Indexmap::Pinger::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/indexmap/pinger/base.rb

Direct Known Subclasses

Google, IndexNow

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration: Indexmap.configuration) ⇒ Base

Returns a new instance of Base.



13
14
15
# File 'lib/indexmap/pinger/base.rb', line 13

def initialize(configuration: Indexmap.configuration)
  @configuration = configuration
end

Class Method Details

.pingObject



9
10
11
# File 'lib/indexmap/pinger/base.rb', line 9

def self.ping(...)
  new(...).ping
end

Instance Method Details

#loggerObject



23
24
25
26
27
28
29
30
31
# File 'lib/indexmap/pinger/base.rb', line 23

def logger
  @logger ||= if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
    Rails.logger
  else
    Logger.new($stderr).tap do |logger|
      logger.level = Logger::WARN
    end
  end
end

#pingObject



17
18
19
20
21
# File 'lib/indexmap/pinger/base.rb', line 17

def ping
  sitemap_files.each do |sitemap_file|
    ping_sitemap(sitemap_file)
  end
end