Sha256: a520a3031dc57ed680407fefd27a46e40b7bf950c6273dc5a4cf029b5dba9ebc

Contents?: true

Size: 914 Bytes

Versions: 4

Compression:

Stored size: 914 Bytes

Contents

class ProgressBar
  module Format
    class Molecule
      MOLECULES = {
        :t => :title,
        :T => :title,
        :c => :progress,
        :C => :total,
        :p => :percentage,
        :P => :percentage_with_precision,
        :a => :elapsed_time,
        :e => :estimated_time_with_unknown_oob,
        :E => :estimated_time_with_friendly_oob,
        :f => :estimated_time_with_no_oob,
        :B => :complete_bar,
        :b => :bar,
        :w => :bar_with_percentage,
        :i => :incomplete_space,
        :r => :rate_of_change,
        :R => :rate_of_change_with_precision,
      }

      BAR_MOLECULES     = %w{w B b i}

      attr_reader   :key
      attr_reader   :method_name

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

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

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 vendor/bundle/ruby/2.1.0/gems/ruby-progressbar-1.5.1/lib/ruby-progressbar/format/molecule.rb
rubyjobbuilderdsl-0.0.1 vendor/bundle/ruby/2.1.0/gems/ruby-progressbar-1.5.1/lib/ruby-progressbar/format/molecule.rb
ruby-progressbar-1.5.1 lib/ruby-progressbar/format/molecule.rb
ruby-progressbar-1.5.0 lib/ruby-progressbar/format/molecule.rb