メモ:遺物

# coding: CP932
require "tapp"
require "inifile"   # gem install inifile
#require "yaml"
require "json"
require "xmlsimple" # gem install xml-simple

def to_json(hash)
  hash.to_json.encode(__ENCODING__)
end

def to_xml(hash)
  XmlSimple.xml_out(hash)
end

Dir["./**/*.ini"].each do |path|

  basename = File.basename(path, ".*")

  IniFile.new(path).tapp.to_h.tap do |hash|

    %w{json xml}.each do |to|

      File.open("#{basename}.#{to}", "w") do |fp|
        fp << send("to_#{to}", hash)
      end

    end

  end

end