lib/cms_scanner/finders/finder.rb in cms_scanner-0.0.37.2 vs lib/cms_scanner/finders/finder.rb in cms_scanner-0.0.37.3

- old
+ new

@@ -1,5 +1,6 @@ +require 'cms_scanner/mocked_progress_bar' require 'cms_scanner/finders/finder/smart_url_checker' require 'cms_scanner/finders/finder/enumerator' require 'cms_scanner/finders/finder/fingerprinter' module CMSScanner @@ -7,11 +8,11 @@ # Finder class Finder # Constants for common found_by DIRECT_ACCESS = 'Direct Access (Aggressive Detection)' - attr_accessor :target + attr_accessor :target, :progress_bar def initialize(target) @target = target end @@ -27,13 +28,16 @@ # @param [ Hash ] _opts def aggressive(_opts = {}) end # @param [ Hash ] opts See https://github.com/jfelchner/ruby-progressbar/wiki/Options + # @option opts [ Boolean ] :show_progression # - # @return [ ProgressBar::Base ] - def progress_bar(opts = {}) - ProgressBar.create({ format: '%t %a <%B> (%c / %C) %P%% %e' }.merge(opts)) + # @return [ ProgressBar::Base, CMSScanner::MockedProgressBar ] + def create_progress_bar(opts = {}) + klass = opts[:show_progression] ? ProgressBar : MockedProgressBar + + @progress_bar = klass.create({ format: '%t %a <%B> (%c / %C) %P%% %e' }.merge(opts)) end # @return [ Browser ] def browser @browser ||= NS::Browser.instance