类:Mongo::Options::Redacted
- 继承:
-
BSON::Document
- 对象
- BSON::Document
- Mongo::Options::Redacted
- 定义于:
- lib/ Mongo/options/redacted.rb
Overview
用于包装可能敏感的选项的类。 打印时,敏感值将被编辑。
常量摘要折叠
- SENSITIVE_OPTIONS =
其值将被编辑的选项。
%i[密码 PWD].冻结
- STRING_REPLACMENT =
用于替换敏感键值的替换string 。
'<REDACTED>'
实例方法摘要折叠
-
# has_key? (key) ⇒ true、false (亦称:#key?)
这些选项是否包含给定的键。
-
#检查⇒ string
获取选项的string表示形式。
-
#拒绝{|The| ... } ="Options::Redacted"
返回一个新的选项对象,该对象由该区块返回 false 的对组成。
-
#拒绝! {|The| ... } ⇒ Options::Redacted ?
仅保留区块返回 false 的数据对。
-
# select {|The| ... } ="Options::Redacted"
返回一个新的选项对象,该对象由该区块返回 true 的对组成。
-
# select! {|The| ... } ⇒ Options::Redacted ?
仅保留区块返回 true 的数据对。
-
# to_s ⇒ string
获取选项的string表示形式。
实例方法详细信息
# has_key? (key) ⇒ true , false也称为: key?
这些选项是否包含给定的键。
63 64 65 |
# File 'lib/ Mongo/options/redacted.rb', line 63 def has_key?(key) 超(convert_key(key)) end |
#检查⇒ string
获取选项的string表示形式。
40 41 42 |
# File 'lib/ Mongo/options/redacted.rb', line 40 def 检查 redacted_string(:inspect) end |
#拒绝{|The| ... } =" Options::Redacted "
返回一个新的选项对象,该对象由该区块返回 false 的对组成。
78 79 80 81 |
# File 'lib/ Mongo/options/redacted.rb', line 78 def 拒绝(和块) = dup .拒绝!(和块) || end |
#拒绝! {|The| ... } ⇒ Options::Redacted ?
仅保留区块返回 false 的数据对。
93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/ Mongo/options/redacted.rb', line 93 def 拒绝! if block_given? n_keys = 密钥.size 密钥.每 do |key| 删除(key) if 产量(key, self[key]) end (n_keys == 密钥.size) ? nil : self else to_enum end end |
# select {|The| ... } =" Options::Redacted "
返回一个新的选项对象,该对象由该区块返回 true 的对组成。
115 116 117 118 |
# File 'lib/ Mongo/options/redacted.rb', line 115 def SELECT(和块) = dup .选择!(和块) || end |
# select! {|The| ... } ⇒ Options::Redacted ?
仅保留区块返回 true 的数据对。
130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/ Mongo/options/redacted.rb', line 130 def 选择! if block_given? n_keys = 密钥.size 密钥.每 do |key| 删除(key) 除非 产量(key, self[key]) end (n_keys == 密钥.size) ? nil : self else to_enum end end |
# to_s ⇒ string
获取选项的string表示形式。
49 50 51 |
# File 'lib/ Mongo/options/redacted.rb', line 49 def to_s redacted_string(:to_s) end |