weigh 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/weigh/util.rb +3 -1
- data/lib/weigh/version.rb +1 -1
- metadata +2 -18
data/lib/weigh/util.rb
CHANGED
@@ -4,7 +4,9 @@ module Weigh
|
|
4
4
|
def self.neat_size(bytes)
|
5
5
|
# return a human readble size from the bytes supplied
|
6
6
|
bytes = bytes.to_f
|
7
|
-
if bytes > 2 **
|
7
|
+
if bytes > 2 ** 50 # PiB: 1024 TiB
|
8
|
+
neat = sprintf("%.2f PiB", bytes / 2**50)
|
9
|
+
elsif bytes > 2 ** 40 # TiB: 1024 GiB
|
8
10
|
neat = sprintf("%.2f TiB", bytes / 2**40)
|
9
11
|
elsif bytes > 2 ** 30 # GiB: 1024 MiB
|
10
12
|
neat = sprintf("%.2f GiB", bytes / 2**30)
|
data/lib/weigh/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weigh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,23 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2013-06-12 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rspec
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
13
|
+
dependencies: []
|
30
14
|
description: Useful utility to weigh the directory contents and sort the output by
|
31
15
|
size in a neatly formatted list.
|
32
16
|
email: xaque208@gmail.com
|