filersize 0.0.1
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.
- checksums.yaml +7 -0
- data/lib/filersize.rb +23 -0
- metadata +43 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: b55ff1c86afd3b70ab7d369699c5d3c1de07b043
|
|
4
|
+
data.tar.gz: 0ceadb4e7eff1520a26acd3529f7b5695ad7f7a6
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b573fb1cf4681f239991565a631bc6ee45bb2c9b307893a40f28d9ea9081ed762e8d2bd3122a39553353c7753a0f8633caf0007e2a9a8d4b9c22c893697cac2b
|
|
7
|
+
data.tar.gz: 7c9bb7fa3db9fefbe9fd0a9ff315fdff243cd02973e4f129e5df22f404881259d1287a083b3ee440a0bc4fdc43a4973e2fa76a2dd4c8fde9977303d7a2c37a8e
|
data/lib/filersize.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module FileSize
|
|
2
|
+
@by = ["B","KB","MB","GB","TB","PB","EB","ZB","YB"]
|
|
3
|
+
def self.sum(files)
|
|
4
|
+
@files = files
|
|
5
|
+
@sumvalue = 0
|
|
6
|
+
@files.each do |value|
|
|
7
|
+
@sumvalue = @sumvalue + value
|
|
8
|
+
end
|
|
9
|
+
@sumvalue = @sumvalue.to_f
|
|
10
|
+
@i = 0
|
|
11
|
+
while @sumvalue > 1024 do
|
|
12
|
+
@sumvalue = @sumvalue / 1024
|
|
13
|
+
@i = @i + 1
|
|
14
|
+
end
|
|
15
|
+
@sumvalue = @sumvalue.round(2)
|
|
16
|
+
@Retval = Array.new
|
|
17
|
+
@Retval << @sumvalue
|
|
18
|
+
@Retval << @by[@i]
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
|
metadata
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: filersize
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Rahul Raghava
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2017-11-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies: []
|
|
13
|
+
description: A simple gem that rturns the sum of of file by the file name
|
|
14
|
+
email: x17108799@student.ncirl.ie
|
|
15
|
+
executables: []
|
|
16
|
+
extensions: []
|
|
17
|
+
extra_rdoc_files: []
|
|
18
|
+
files:
|
|
19
|
+
- lib/filersize.rb
|
|
20
|
+
homepage: http://rubygems.org/gems/Filersize
|
|
21
|
+
licenses: []
|
|
22
|
+
metadata: {}
|
|
23
|
+
post_install_message:
|
|
24
|
+
rdoc_options: []
|
|
25
|
+
require_paths:
|
|
26
|
+
- lib
|
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
28
|
+
requirements:
|
|
29
|
+
- - ">="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: '0'
|
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
33
|
+
requirements:
|
|
34
|
+
- - ">="
|
|
35
|
+
- !ruby/object:Gem::Version
|
|
36
|
+
version: '0'
|
|
37
|
+
requirements: []
|
|
38
|
+
rubyforge_project:
|
|
39
|
+
rubygems_version: 2.6.8
|
|
40
|
+
signing_key:
|
|
41
|
+
specification_version: 4
|
|
42
|
+
summary: This gem returns sum all file of file
|
|
43
|
+
test_files: []
|