Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more
Object
escaped char map
escape with backslash and doubled dq
escape with backslash
# File openssl/lib/openssl/config.rb, line 212
def initialize(filename = nil)
@data = {}
if filename
File.open(filename.to_s) do |file|
Config.parse_config(file).each do |section, hash|
self[section] = hash
end
end
end
end
# File openssl/lib/openssl/config.rb, line 248
def [](section)
@data[section] || {}
end
# File openssl/lib/openssl/config.rb, line 257
def []=(section, pairs)
check_modify
@data[section] ||= {}
pairs.each do |key, value|
self.add_value(section, key, value)
end
end
# File openssl/lib/openssl/config.rb, line 243
def add_value(section, key, value)
check_modify
(@data[section] ||= {})[key] = value
end
# File openssl/lib/openssl/config.rb, line 281
def each
@data.each do |section, hash|
hash.each do |key, value|
yield [section, key, value]
end
end
end
# File openssl/lib/openssl/config.rb, line 223
def get_value(section, key)
if section.nil?
raise TypeError.new('nil not allowed')
end
section = 'default' if section.empty?
get_key_string(section, key)
end
# File openssl/lib/openssl/config.rb, line 289
def inspect
"#<#{self.class.name} sections=#{sections.inspect}>"
end
# File openssl/lib/openssl/config.rb, line 252
def section(name)
warn('Config#section is deprecated; use Config#[]')
@data[name] || {}
end
# File openssl/lib/openssl/config.rb, line 265
def sections
@data.keys
end
# File openssl/lib/openssl/config.rb, line 269
def to_s
ary = []
@data.keys.sort.each do |section|
ary << "[ #{section} ]\n"
@data[section].keys.each do |key|
ary << "#{key}=#{@data[section][key]}\n"
end
ary << "\n"
end
ary.join
end
# File openssl/lib/openssl/config.rb, line 231
def value(arg1, arg2 = nil)
warn('Config#value is deprecated; use Config#get_value')
if arg2.nil?
section, key = 'default', arg1
else
section, key = arg1, arg2
end
section ||= 'default'
section = 'default' if section.empty?
get_key_string(section, key)
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.