This repository was archived by the owner on Sep 6, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ module Manip
6
6
MEBIBYTE = 1048576
7
7
8
8
def self.bytes_to_mebibytes (bytes : String ) : String
9
- # Implement turning bytes into Mebibytes
10
9
bytes = bytes.strip.to_f / MEBIBYTE
11
10
11
+ # return with two decimal places
12
12
" %.2f" % bytes
13
13
end
14
14
end
@@ -19,11 +19,12 @@ module Resource
19
19
end
20
20
21
21
private def self.scrape_file (query : String , file : String ) : String
22
- release_file = file
23
- ` grep #{ query } #{ release_file } `
24
- .split('=' , 2 )
25
- .last
26
- .delete('"' )
22
+ File .each_line(file) do |line |
23
+ if line.includes?(query)
24
+ return line.split('=' , 2 )[1 ].delete('"' ).strip
25
+ end
26
+ end
27
+ " "
27
28
end
28
29
29
30
def self.get_platform : String
@@ -57,7 +58,7 @@ module Resource
57
58
end
58
59
59
60
def self.get_host : String
60
- ` hostname`
61
+ System . hostname
61
62
end
62
63
63
64
def self.get_shell : String
@@ -110,6 +111,7 @@ module OptionHandler
110
111
property separator = " -> "
111
112
end
112
113
114
+ # inherit the Exception class
113
115
class OptionError < Exception ; end
114
116
115
117
def self.parse
You can’t perform that action at this time.
0 commit comments