class ProgressBar::Format::String

Constants

ANSI_SGR_PATTERN
MOLECULE_PATTERN

Public Instance Methods

bar_molecule_placeholder_length() click to toggle source
# File lib/ruby-progressbar/format/string.rb, line 13
def bar_molecule_placeholder_length
  @bar_molecule_placeholder_length ||= bar_molecules.size * 2
end
bar_molecules() click to toggle source
# File lib/ruby-progressbar/format/string.rb, line 21
def bar_molecules
  @bar_molecules ||= molecules.select(&:bar_molecule?)
end
displayable_length() click to toggle source
# File lib/ruby-progressbar/format/string.rb, line 9
def displayable_length
  gsub(ANSI_SGR_PATTERN, '').length
end
molecules() click to toggle source
# File lib/ruby-progressbar/format/string.rb, line 25
def molecules
  @molecules ||= begin
                    molecules = []

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

                    molecules
                 end
end
non_bar_molecules() click to toggle source
# File lib/ruby-progressbar/format/string.rb, line 17
def non_bar_molecules
  @non_bar_molecules ||= molecules.select(&:non_bar_molecule?)
end