本文簡要介紹ruby語言中 OpenSSL::Config.get_value
的用法。
用法
get_value(section, key) → string
從給定的 section
中獲取 key
的值。
鑒於正在加載以下配置文件:
config = OpenSSL::Config.load('foo.cnf')
#=> #<OpenSSL::Config sections=["default"]>
puts config.to_s
#=> [ default ]
# foo=bar
如果您知道 section
和 key
,則可以從配置中獲取特定值,如下所示:
config.get_value('default','foo')
#=> "bar"
相關用法
- Ruby Config.to_s用法及代碼示例
- Ruby Config.config[section]用法及代碼示例
- Ruby Config.each用法及代碼示例
- Ruby ConfigFile類用法及代碼示例
- Ruby Context.save_history=用法及代碼示例
- Ruby Constants模塊用法及代碼示例
- Ruby Continuation類用法及代碼示例
- Ruby Context.echo_on_assignment?用法及代碼示例
- Ruby Converter.primitive_errinfo用法及代碼示例
- Ruby Context.echo?用法及代碼示例
- Ruby Context.echo_on_assignment用法及代碼示例
- Ruby Constructive類用法及代碼示例
- Ruby Constructive.each用法及代碼示例
- Ruby Context.auto_indent_mode用法及代碼示例
- Ruby Converter.convert用法及代碼示例
- Ruby Converter.inspect用法及代碼示例
- Ruby Converter.insert_output用法及代碼示例
- Ruby ConditionVariable類用法及代碼示例
- Ruby Context.newline_before_multiline_output用法及代碼示例
- Ruby Converter.search_convpath用法及代碼示例
- Ruby Converter.last_error用法及代碼示例
- Ruby Converter.primitive_convert用法及代碼示例
- Ruby Context.newline_before_multiline_output?用法及代碼示例
- Ruby Converter.putback用法及代碼示例
- Ruby Context.echo用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Config.get_value。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。