kibi 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/kibi/kibi.rb +9 -1
  2. metadata +1 -1
@@ -1,4 +1,5 @@
1
1
  require 'units'
2
+ require 'pathname'
2
3
 
3
4
  module Kibi
4
5
  class << self
@@ -23,5 +24,12 @@ module Kibi
23
24
  end
24
25
  end
25
26
 
27
+ def humanize_file_size path
28
+ p = Pathname.new File.expand_path(path)
29
+ raise "File #{path} does not exist" unless p.exist?
30
+ raise "Path must be a file (#{path} is a directory)" if p.directory?
31
+
32
+ humanize p.size
33
+ end
26
34
  end
27
- end
35
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kibi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: