Sha256: 975056e5507a835b763932ff2ef61a752be48c70a44ea55c66c11456da45a216

Contents?: true

Size: 375 Bytes

Versions: 1

Compression:

Stored size: 375 Bytes

Contents

module VER
  class Status
    class Percent < Position
      def to_s
        here = buffer.count(1.0, :insert, :lines)
        total = buffer.count(1.0, :end, :lines)
        percent = ((100.0 / total) * here).round

        case percent
        when 100, 99; 'Bot'
        when 0      ; 'Top'
        else        ; '%2d%%' % percent
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ver-2010.08 lib/ver/status/percent.rb