avmtrf1-tools 0.8.0 → 0.8.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 +4 -4
- data/lib/avmtrf1/ini.rb +11 -1
- data/lib/avmtrf1/tools/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f03d926a7ddca3b912f57174f50f650ff3a4b6400cd02e272fa5fb3d39c4ff93
|
4
|
+
data.tar.gz: 24bc88f1cff2bb1242caa262432dc0ed61c2bcbce05e96712e139c262e8938a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56e39a9c82c64ed30da2124b886326863ac676fdc849a6547930bb2a6497f64009819d51c3c7f42e3f1f01b97ac6bab0386cf570f73f700d251e0e8fd812b11d
|
7
|
+
data.tar.gz: f478e7dac578971f6ee30fb96f7e8c29046cbf4929bc04f463b648f5dfedc2e43b1111d21329c8c7404ef8f092926b0d9acc6530afee700dee940655cfcaf7f1
|
data/lib/avmtrf1/ini.rb
CHANGED
@@ -20,13 +20,23 @@ module Avmtrf1
|
|
20
20
|
|
21
21
|
raise "Section name pattern \"#{SECTION_NAME_PATTERN}\" not match \"#{section_name}\""
|
22
22
|
end
|
23
|
+
|
24
|
+
# @return [IniFile].
|
25
|
+
def inifile_from_file(path)
|
26
|
+
raise "\"#{path}\" does not exist or is not a file" unless ::File.file?(path)
|
27
|
+
|
28
|
+
r = ::IniFile.load(path)
|
29
|
+
return r if r.is_a?(::IniFile)
|
30
|
+
|
31
|
+
raise "\"#{path}\" not converted to Inifile"
|
32
|
+
end
|
23
33
|
end
|
24
34
|
|
25
35
|
attr_reader :inifile
|
26
36
|
|
27
37
|
# @param ini Um [IniFile] ou um caminho de arquivo .ini.
|
28
38
|
def initialize(inifile)
|
29
|
-
@inifile = ::IniFile
|
39
|
+
@inifile = inifile.is_a?(::IniFile) ? inifile : self.class.inifile_from_file(inifile.to_s)
|
30
40
|
end
|
31
41
|
|
32
42
|
private
|