Class: Avmtrf1::Ini
- Inherits:
-
Object
- Object
- Avmtrf1::Ini
- Includes:
- EacRubyUtils::SimpleCache
- Defined in:
- lib/avmtrf1/ini.rb,
lib/avmtrf1/ini/profile.rb
Overview
Leitor de arquivos .ini com suporte a herança de seções/perfis.
Defined Under Namespace
Classes: Profile
Constant Summary collapse
- SECTION_NAME_PATTERN =
/\A([^\:]+)(?::([^\:]+))?\z/.freeze
Instance Attribute Summary collapse
-
#inifile ⇒ Object
readonly
Returns the value of attribute inifile.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(inifile) ⇒ Ini
constructor
A new instance of Ini.
Constructor Details
Instance Attribute Details
#inifile ⇒ Object (readonly)
Returns the value of attribute inifile.
35 36 37 |
# File 'lib/avmtrf1/ini.rb', line 35 def inifile @inifile end |
Class Method Details
.inifile_from_file(path) ⇒ IniFile
Returns .
25 26 27 28 29 30 31 32 |
# File 'lib/avmtrf1/ini.rb', line 25 def inifile_from_file(path) raise "\"#{path}\" does not exist or is not a file" unless ::File.file?(path) r = ::IniFile.load(path) return r if r.is_a?(::IniFile) raise "\"#{path}\" not converted to Inifile" end |
.parse_section_name(section_name) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/avmtrf1/ini.rb', line 17 def parse_section_name(section_name) m = SECTION_NAME_PATTERN.match(section_name) return [m[1], m[2]] if m raise "Section name pattern \"#{SECTION_NAME_PATTERN}\" not match \"#{section_name}\"" end |