Sha256: caaca2996e17ef8d6c575f834325db94bcc7b48fc402538897104aac8ab5b894

Contents?: true

Size: 801 Bytes

Versions: 2569

Compression:

Stored size: 801 Bytes

Contents

class   ProgressBar
module  Format
class   String < ::String
  MOLECULE_PATTERN = /%[a-zA-Z]/.freeze
  ANSI_SGR_PATTERN = /\e\[[\d;]+m/.freeze

  def displayable_length
    gsub(ANSI_SGR_PATTERN, '').length
  end

  def bar_molecule_placeholder_length
    @bar_molecule_placeholder_length ||= bar_molecules.size * 2
  end

  def non_bar_molecules
    @non_bar_molecules ||= molecules.select(&:non_bar_molecule?)
  end

  def bar_molecules
    @bar_molecules ||= molecules.select(&:bar_molecule?)
  end

  def molecules
    @molecules ||= begin
                      molecules = []

                      scan(MOLECULE_PATTERN) do |match|
                        molecules << Molecule.new(match[1, 1])
                      end

                      molecules
                   end
  end
end
end
end

Version data entries

2,569 entries across 2,566 versions & 23 rubygems

Version Path
zilla-0.2.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
ory-keto-client-0.11.0.alpha0 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_id_ruby-0.62.44 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_organization_ruby-0.62.44 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_bank_ruby-0.62.44 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
mux_ruby-3.9.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_bank_ruby-0.62.43 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_organization_ruby-0.62.43 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_id_ruby-0.62.43 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_bank_ruby-0.62.41 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_organization_ruby-0.62.41 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_id_ruby-0.62.41 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_bank_ruby-0.62.40 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_id_ruby-0.62.40 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_organization_ruby-0.62.40 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_bank_ruby-0.62.39 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_organization_ruby-0.62.39 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_id_ruby-0.62.39 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
primary_connect_proto-0.19.0 vendor/bundle/ruby/3.0.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb
cybrid_api_bank_ruby-0.62.38 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/format/string.rb