Method: Ronin::Web::CLI::Commands::Screenshot#image_path_for

Defined in:
lib/ronin/web/cli/commands/screenshot.rb

#image_path_for(url) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Generates the image path for a given URL.

Parameters:

  • url (String)

    The given URL.

Returns:

  • (String)

    The relative image path that represents the URL.

Since:

  • 1.0.0



172
173
174
175
176
177
178
179
180
# File 'lib/ronin/web/cli/commands/screenshot.rb', line 172

def image_path_for(url)
  uri = parse_url(url)

  path = File.join(options[:directory],uri.host,uri.request_uri)
  path << 'index' if path.end_with?('/')
  path << ".#{options[:format]}"

  return path
end