lib/cms_scanner.rb in cms_scanner-0.0.40.2 vs lib/cms_scanner.rb in cms_scanner-0.0.40.3

- old
+ new

@@ -38,29 +38,63 @@ # Module module CMSScanner APP_DIR = Pathname.new(__FILE__).dirname.join('..', 'app').expand_path NS = self - # Number of requests performed to display at the end of the scan + # Number of requests performed and data sent/received to display at the end of the scan Typhoeus.on_complete do |response| + self.cached_requests += 1 if response.cached? + next if response.cached? self.total_requests += 1 + self.total_data_sent += response.request_size + self.total_data_received += response.size NS::Browser.instance.trottle! end # Module to be able to use these class methods when the CMSScanner # is included in another module module ClassMethods # @return [ Integer ] + def cached_requests + @@cached_requests ||= 0 + end + + # @param [ Integer ] value + def cached_requests=(value) + @@cached_requests = value + end + + # @return [ Integer ] def total_requests @@total_requests ||= 0 end - # @param [ Integer ] + # @param [ Integer ] value def total_requests=(value) @@total_requests = value + end + + # @return [ Integer ] + def total_data_sent + @@total_data_sent ||= 0 + end + + # @param [ Integer ] value + def total_data_sent=(value) + @@total_data_sent = value + end + + # @return [ Integer ] + def total_data_received + @@total_data_received ||= 0 + end + + # @param [ Integer ] value + def total_data_received=(value) + @@total_data_received = value end # The lowercase name of the scanner # Mainly used in directory paths like the default cookie-jar file and # path to load the cli options from files