Hash
This class parses the contents of an INI file.
Creates a new class instance and reads in the contents of the supplied file path.
# File lib/rex/parser/ini.rb, line 21 def self.from_file(path) ini = Ini.new(path) ini.from_file return ini end
Creates a new class instance from the supplied string.
# File lib/rex/parser/ini.rb, line 30 def self.from_s(str) ini = Ini.new ini.from_s(str) return ini end
Initializes an ini instance and tries to read in the groups from the file if it exists.
# File lib/rex/parser/ini.rb, line 40 def initialize(path = nil) self.path = path # Try to synchronize ourself with the file if we # have one begin self.from_file if (self.path) rescue end end
Adds a group of the supplied name if it doesn't already exist.
# File lib/rex/parser/ini.rb, line 63 def add_group(name = 'global', reset = true) self[name] = {} if (reset == true) self[name] = {} if (!self[name]) return self[name] end
Enumerates the groups hash keys.
# File lib/rex/parser/ini.rb, line 54 def each_group(&block) self.keys.each { |k| yield } end
Reads in the groups from the supplied file path or the instance's file path.
# File lib/rex/parser/ini.rb, line 87 def from_file(fpath = nil) fpath = path if (!fpath) read_groups(fpath) end
Reads in the groups from the supplied string.
# File lib/rex/parser/ini.rb, line 96 def from_s(str) read_groups_string(str.split("\n")) end
Checks to see if name is a valid group.
# File lib/rex/parser/ini.rb, line 73 def group?(name) return (self[name] != nil) end
Generated with the Darkfish Rdoc Generator 2.