clutil 2014.304.2 → 2015.068.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/cl/util/file.rb +5 -2
  2. metadata +5 -5
@@ -105,12 +105,15 @@ class << File
105
105
 
106
106
  # human readable size
107
107
  def h_size(filename)
108
- size = File.size(filename)
108
+ to_h_size(File.size(filename))
109
+ end
110
+
111
+ def to_h_size(size)
109
112
  return '0B' if size == 0
110
113
  units = %w{B KB MB GB TB}
111
114
  e = (Math.log(size) / Math.log(1024)).floor
112
115
  s = "%.0f" % (size.to_f / 1024**e)
113
- s.sub(/\.?0*$/, units[e])
116
+ "#{s}#{units[e]}"
114
117
  end
115
118
  end
116
119
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clutil
3
3
  version: !ruby/object:Gem::Version
4
- version: 2014.304.2
4
+ version: 2015.068.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-31 00:00:00.000000000 Z
12
+ date: 2015-03-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -48,7 +48,7 @@ files:
48
48
  - cl/util/test.rb
49
49
  - cl/util/time.rb
50
50
  - cl/util/win.rb
51
- homepage: http://clabs.org/ruby.htm
51
+ homepage: https://github.com/chrismo/clutil
52
52
  licenses:
53
53
  - MIT
54
54
  post_install_message:
@@ -63,7 +63,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
63
63
  version: '0'
64
64
  segments:
65
65
  - 0
66
- hash: -2810326455611412791
66
+ hash: 1319166832057909282
67
67
  required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  none: false
69
69
  requirements:
@@ -72,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  version: '0'
73
73
  segments:
74
74
  - 0
75
- hash: -2810326455611412791
75
+ hash: 1319166832057909282
76
76
  requirements: []
77
77
  rubyforge_project:
78
78
  rubygems_version: 1.8.23.2