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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 488a4826095240654ea0d4de46002cbf385a7c064ed2c860c4f2f13d9befcdd3
4
- data.tar.gz: 68a6d46f0388d806bd6248aca8b89161726b7a3c32d964e5bf361392f3bb37a2
3
+ metadata.gz: f03d926a7ddca3b912f57174f50f650ff3a4b6400cd02e272fa5fb3d39c4ff93
4
+ data.tar.gz: 24bc88f1cff2bb1242caa262432dc0ed61c2bcbce05e96712e139c262e8938a7
5
5
  SHA512:
6
- metadata.gz: 9a411e8c9120b8b4d88963184a6a4d05343d3905b7807ea41707c423a443bb38e06af62ffc53141cf29e310f0c49c416f28ae884b88ebffc598efb7db4bd2c85
7
- data.tar.gz: 58b316650009ad2e76fd7d0890eb191da17bc53492222155a4a807e5906e0e06d9b838d0fb2b01633111c9521a6f1455d0ae30959b7557bb038c3e6a9300d779
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.load(inifile.to_s) unless inifile.is_a?(::IniFile)
39
+ @inifile = inifile.is_a?(::IniFile) ? inifile : self.class.inifile_from_file(inifile.to_s)
30
40
  end
31
41
 
32
42
  private
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Avmtrf1
4
4
  module Tools
5
- VERSION = '0.8.0'
5
+ VERSION = '0.8.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avmtrf1-tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo H. Bogoni