As of Ruby 1.9, uuid generation is built-in. Use the SecureRandom.uuid
function.
For example:
require 'securerandom'
SecureRandom.uuid # => "96b0a57c-d9ae-453f-b56f-3b154eb10cda"
More Related Contents:
- Regex for reverse match a string
- How to write a switch statement in Ruby
- Ruby, Difference between exec, system and %x() or Backticks
- What is the difference or value of these block coding styles in Ruby?
- How to understand symbols in Ruby
- Look up all descendants of a class in Ruby
- “for” vs “each” in Ruby
- Mixing keyword with regular arguments in Ruby?
- String concatenation vs. interpolation in Ruby
- Block definition – difference between braces and do-end?
- When to use RSpec let()?
- How can I use Ruby to colorize the text output to a terminal? [closed]
- what’s different between each and collect method in Ruby [duplicate]
- How to merge Ruby hashes
- I don’t understand ruby local scope
- Weird backslash substitution in Ruby
- Strange \n in base64 encoded string in Ruby
- Printing the source code of a Ruby block
- Double Pipe Symbols in Ruby Variable Assignment? [duplicate]
- Why does Ruby’s ‘gets’ includes the closing newline?
- Error to install Nokogiri on OSX 10.9 Maverick?
- How do I avoid trailing empty items being removed when splitting strings?
- How do I test a function with gets.chomp in it?
- Ruby: Can I write multi-line string with no concatenation?
- How to preserve request url with nginx proxy_pass
- Ruby RVM apt-get update error
- Ruby dependency injection libraries
- Method and variable name is the same
- How to turn a string into a method call? [duplicate]
- Combine two Arrays into Hash