Sha256: 7e22d34456ca23f7771869a367e1aaeef838251f79f7cbce6f886dc3bb6b39e9

Contents?: true

Size: 776 Bytes

Versions: 8

Compression:

Stored size: 776 Bytes

Contents

class   ProgressBar
module  Format
class   Formatter
  def self.process(format_string, max_length, bar)
    processed_string = format_string.dup

    format_string.non_bar_molecules.each do |molecule|
      processed_string.gsub!(molecule.full_key, molecule.lookup_value(bar, nil))
    end

    processed_string.gsub!(/%%/, '%')

    bar_length         = max_length -
                         processed_string.displayable_length +
                         format_string.bar_molecule_placeholder_length
    bar_length         = bar_length < 0 ? 0 : bar_length

    format_string.bar_molecules.each do |molecule|
      processed_string.gsub!(molecule.full_key,
                             molecule.lookup_value(bar, bar_length))
    end

    processed_string
  end
end
end
end

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
fluent-plugin-detect-memb-exceptions-0.0.2 vendor/bundle/ruby/2.0.0/gems/ruby-progressbar-1.8.1/lib/ruby-progressbar/format/formatter.rb
fluent-plugin-detect-memb-exceptions-0.0.1 vendor/bundle/ruby/2.0.0/gems/ruby-progressbar-1.8.1/lib/ruby-progressbar/format/formatter.rb
progressbar-1.8.2 lib/ruby-progressbar/format/formatter.rb
ruby-progressbar-1.8.1 lib/ruby-progressbar/format/formatter.rb
ruby-progressbar-1.8.0 lib/ruby-progressbar/format/formatter.rb
ruby-progressbar-1.7.5 lib/ruby-progressbar/format/formatter.rb
ruby-progressbar-1.7.1 lib/ruby-progressbar/format/formatter.rb
ruby-progressbar-1.7.0 lib/ruby-progressbar/format/formatter.rb