Method: SecureString#initialize
- Defined in:
- lib/secure_string.rb
#initialize(value, opts = {}) ⇒ SecureString
Creates the string from one many kinds of values:
- :data
-
(default) The passed string value is directly used.
- :hex
-
Initialize using a hexidecimal string.
- :int
-
Initialize using the numeric value of the hexidecimal string.
- :base64
-
Initialize using the given base64 encoded data.
To specify a value kind, pass the :type option.
16 17 18 19 20 |
# File 'lib/secure_string.rb', line 16 def initialize(value, opts={}) raise ArgumentError, "The first argument is a symbol; setting the input data type this way is no longer supported. Call `#{self.class.name}.new('string', :type => #{value.inspect})' instead.", caller if value.kind_of?(Symbol) data_string = self.class.parse_data(value, opts) self.replace(data_string) end |