Sha256: 92fef0ec3c2f785fb6720ade06e4fbd0e47805d8f4056b9686730e44088b85c9

Contents?: true

Size: 1.45 KB

Versions: 14

Compression:

Stored size: 1.45 KB

Contents

class ProgressBar
  module Format
    class Molecule
      MOLECULES = {
        :t => [:left_justified_title,               :title],
        :T => [:right_justified_title,              :title],
        :c => [:current_progress,                   :progress],
        :C => [:total_capacity,                     :total],
        :p => [:percentage_complete_as_integer,     :percentage],
        :P => [:percentage_complete_as_float,       :percentage_with_precision],
        :a => [:elapsed_time,                       :elapsed_time],
        :e => [:estimated_time_with_unknown,        :estimated_time_with_unknown_oob],
        :E => [:estimated_time_with_greater_than,   :estimated_time_with_friendly_oob],
        :f => [:force_estimated_time,               :estimated_time_with_no_oob],
        :B => [:complete_bar,                       :complete_bar],
        :b => [:bar,                                :bar],
        :w => [:bar_with_percentage,                :bar_with_percentage],
        :i => [:incomplete_space,                   :incomplete_space]
      }

      BAR_MOLECULES     = %w{w B b i}

      attr_reader   :key
      attr_reader   :method_name
      attr_reader   :method_arguments

      def initialize(letter)
        @key                                          = letter
        @description, @method_name, @method_arguments = MOLECULES.fetch(@key.to_sym)
      end

      def bar_molecule?
        BAR_MOLECULES.include? @key
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
ruby-progressbar-1.4.2 lib/ruby-progressbar/format/molecule.rb
ruby-progressbar-1.4.1 lib/ruby-progressbar/format/molecule.rb
ruby-progressbar-1.4.0 lib/ruby-progressbar/format/molecule.rb
ruby-progressbar-1.3.2 lib/ruby-progressbar/format/molecule.rb
ruby-progressbar-1.3.1 lib/ruby-progressbar/format/molecule.rb
ruby-progressbar-1.3.0 lib/ruby-progressbar/format/molecule.rb
ruby-progressbar-1.2.0 lib/ruby-progressbar/format/molecule.rb
ruby-progressbar-1.1.1 lib/progress_bar/format/molecule.rb
ruby-progressbar-1.1.0 lib/progress_bar/format/molecule.rb
sunrise-cms-0.5.0.rc1 vendor/bundle/ruby/1.9.1/gems/ruby-progressbar-1.0.2/lib/progress_bar/format/molecule.rb
ruby-progressbar-1.0.2 lib/progress_bar/format/molecule.rb
ruby-progressbar-1.0.1 lib/progress_bar/format/molecule.rb
ruby-progressbar-1.0.0 lib/progress_bar/format/molecule.rb
ruby-progressbar-1.0.0rc1 lib/progress_bar/format/molecule.rb