class ProgressBar::Base
def initialize(options = {}) # rubocop:disable Metrics/AbcSize
def initialize(options = {}) # rubocop:disable Metrics/AbcSize options[:projector] ||= {} self.autostart = options.fetch(:autostart, true) self.autofinish = options.fetch(:autofinish, true) self.finished = false self.timer = Timer.new(options) projector_opts = if options[:projector].any? options[:projector] elsif options[:smoothing] warn SMOOTHING_DEPRECATION_WARNING { :strength => options[:smoothing] } elsif options[:running_average_rate] warn RUNNING_AVERAGE_RATE_DEPRECATION_WARNING { :strength => options[:smoothing] } else {} end self.projector = Projector. from_type(options[:projector][:type]). new(projector_opts) self.progressable = Progress.new(options) options = options.merge(:progress => progressable, :projector => projector, :timer => timer) self.title_component = Components::Title.new(options) self.bar_component = Components::Bar.new(options) self.percentage_component = Components::Percentage.new(options) self.rate_component = Components::Rate.new(options) self.time_component = Components::Time.new(options) self.output = Output.detect(options.merge(:bar => self)) @format = Format::String.new(output.resolve_format(options[:format])) start :at => options[:starting_at] if autostart end