Trying to understand the SaltedHashLoginGenerator and came across this.
What does the .delete(‘form’) do?
Thanks!
Trying to understand the SaltedHashLoginGenerator and came across this.
What does the .delete(‘form’) do?
Thanks!
Trying to understand the SaltedHashLoginGenerator and came across this.
What does the .delete(‘form’) do?
http://corelib.rubyonrails.org/classes/Hash.html#M000710
Deletes and returns a key-value pair from hsh whose key is equal to key.
If the key is not found, returns the default value. If the optional code
block is given and the key is not found, pass in the key and return the
result of block.
h = { "a" => 100, "b" => 200 }
h.delete("a") #=> 100
h.delete("z") #=> nil
h.delete("z") { |el| "#{el} not found" } #=> "z not found"
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs