Class: EnvatoOptimiser::TotalImageWeightCheck

Inherits:
Checks
  • Object
show all
Defined in:
lib/envato_optimiser/checks/total_image_weight_check.rb

Instance Method Summary collapse

Constructor Details

#initialize(image_urls) ⇒ Nothing

Initialize a total image weight check.

Parameters:

  • image_urls (Array)

    Image URLs that you would like to fetch the total image weight for.



9
10
11
12
# File 'lib/envato_optimiser/checks/total_image_weight_check.rb', line 9

def initialize(image_urls)
  @total_image_weight = 0
  get_total_image_weight(image_urls)
end

Instance Method Details

#to_hHash

Format the results into a usable Hash.

Returns:

  • (Hash)

    :total_image_weight is the total image size in bytes.



17
18
19
20
21
# File 'lib/envato_optimiser/checks/total_image_weight_check.rb', line 17

def to_h
  {
    :total_image_weight => @total_image_weight
  }
end