RubyGems Navigation menu

pythonconfig 1.0.1

PythonConfig is a module with classes for parsing and writing Python configuration files created by the ConfigParser classes in Python. These files are structured like this: [Section Name] key = value otherkey: othervalue [Other Section] key: value3 otherkey = value4 Leading whitespace before values are trimmed, and the key must be the at the start of the line - no leading whitespace there. You can use : or = . Multiline values are supported, as long as the second (or third, etc.) lines start with whitespace: [Section] bigstring: This is a very long string, so I'm not sure I'll be able to fit it on one line, but as long as there is one space before each line, I'm ok. Tabs work too. Also, this class supports interpolation: [Awards] output: Congratulations for winning %(prize)! prize: the lottery Will result in: config.sections["Awards"]["output"] == "Congratulations for winning the lottery!" You can also access the sections with the dot operator, but only with all-lowercase: [Awards] key:value [prizes] lottery=3.2 million config.awards["key"] #=> "value" config.prizes["lottery"] #=> "3.2 million" You can modify any values you want, though to add sections, you should use the add_section method. config.sections["prizes"]["lottery"] = "100 dollars" # someone hit the jackpot config.add_section("Candies") config.candies["green"] = "tasty" When you want to output a configuration, just call its +to_s+ method. File.open("output.ini","w") do |out| out.write config.to_s end

Gemfile:
= 复制到剪贴板 已复制!

安装:
=

版本列表:

  1. 1.0.1 - March 28, 2009* (7.5 KB)
  2. 1.0.0 - March 28, 2009* (7.5 KB)

Development 依赖 (1):

hoe >= 1.11.0

业主:

作者:

  • FIX

SHA 256 校验和:

2c87b64112906712cf16c94b81e200bea63f33660c994a9a5dcbabe7ae624df0

下载总量 24,629

这个版本 21,202

许可:

需要的 Ruby 版本:

链接: