class ProgressBar::Format::Molecule
Constants
- BAR_MOLECULES
- MOLECULES
Attributes
key[RW]
method_name[RW]
Public Class Methods
new(letter)
click to toggle source
# File lib/ruby-progressbar/format/molecule.rb, line 33 def initialize(letter) self.key = letter self.method_name = MOLECULES.fetch(key.to_sym) end
Public Instance Methods
bar_molecule?()
click to toggle source
# File lib/ruby-progressbar/format/molecule.rb, line 38 def bar_molecule? BAR_MOLECULES.include? key end
full_key()
click to toggle source
# File lib/ruby-progressbar/format/molecule.rb, line 46 def full_key "%#{key}" end
lookup_value(environment, length = 0)
click to toggle source
# File lib/ruby-progressbar/format/molecule.rb, line 50 def lookup_value(environment, length = 0) component = environment.__send__(method_name[0]) if bar_molecule? component.__send__(method_name[1], length).to_s else component.__send__(method_name[1]).to_s end end
non_bar_molecule?()
click to toggle source
# File lib/ruby-progressbar/format/molecule.rb, line 42 def non_bar_molecule? !bar_molecule? end