Class: Rake::Delphi::IniProperty

Inherits:
BasicTask show all
Defined in:
lib/rake/common/initask.rb

Class Method Summary collapse

Methods inherited from BasicTask

#initialize, #trace?

Constructor Details

This class inherits a constructor from Rake::Delphi::BasicTask

Class Method Details

.get(string) ⇒ Object



17
18
19
20
21
# File 'lib/rake/common/initask.rb', line 17

def self.get(string)
    file, section, valuename = parse(string)
    ini = IniFile.load(file)
    return ini[section][valuename]
end

.parse(string) ⇒ Object



10
11
12
13
14
15
# File 'lib/rake/common/initask.rb', line 10

def self.parse(string)
    dir = File.dirname(string)
    file, section, valuename = string.gsub(dir, '').split(":")
    file = dir + '/' + File.basename(file)
    return file, section, valuename
end

.set(string, value) ⇒ Object



23
24
25
26
27
28
# File 'lib/rake/common/initask.rb', line 23

def self.set(string, value)
    file, section, valuename = parse(string)
    ini = IniFile.load(file)
    ini[section][valuename] = value
    ini.write
end