This file is indexed.

/usr/lib/ruby/1.8/ramaze/snippets/numeric/filesize_format.rb is in libramaze-ruby1.8 2010.06.18-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#          Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
# All files in this distribution are subject to the terms of the Ruby license.

module Ramaze
  module CoreExtensions

    # Extensions for Numeric
    module Numeric
      FILESIZE_FORMAT = [
        ['%.1fT', 1 << 40],
        ['%.1fG', 1 << 30],
        ['%.1fM', 1 << 20],
        ['%.1fK', 1 << 10],
      ]

      # Output this number as easily readable filesize.
      # Usage:
      #   100_000.filesize_format             # => "97.7K"
      #   100_000_000.filesize_format         # => "95.4M"
      #   100_000_000_000.filesize_format     # => "93.1G"
      #   100_000_000_000_000.filesize_format # => "90.9T"
      def filesize_format
        FILESIZE_FORMAT.each do |format, size|
          return format % (self.to_f / size) if self >= size
        end

        self.to_s
      end
    end

  end
end