Module: SecretString::CoreExtensions::String
- Defined in:
- lib/secret_string/core_extensions/string.rb
Overview
Make sure a String can be used as a SecretString. This helps in avoiding code like “if my_str.is_a?(SecretString)” to access to its content.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Compare the String with another object.
-
#erase ⇒ Object
Erase the string.
-
#to_unprotected ⇒ Object
Return the unprotected String.
Instance Method Details
#==(other) ⇒ Object
Compare the String with another object
- Parameters
-
other (Object): Other object
- Result
-
Boolean: Are objects equal?
28 29 30 31 32 33 34 |
# File 'lib/secret_string/core_extensions/string.rb', line 28 def ==(other) if other.is_a?(SecretString) other == self else super end end |
#erase ⇒ Object
Erase the string
18 19 20 |
# File 'lib/secret_string/core_extensions/string.rb', line 18 def erase # Nothing to do end |
#to_unprotected ⇒ Object
Return the unprotected String
- Result
-
String: Unprotected string
13 14 15 |
# File 'lib/secret_string/core_extensions/string.rb', line 13 def to_unprotected self end |