flush(output=nil)
public
Flush the group database. If output is given the database will be
written there instead of to the original path.
Show source
def flush(output=nil)
output ||= @path
tmp = Tempfile.new("htgroup", File::dirname(output))
begin
@group.keys.sort.each{|group|
tmp.puts(format("%s: %s", group, self.members(group).join(" ")))
}
tmp.close
File::rename(tmp.path, output)
rescue
tmp.close(true)
end
end