Skip to content

Instantly share code, notes, and snippets.

@paul
Created October 2, 2008 23:46
Show Gist options
  • Save paul/14475 to your computer and use it in GitHub Desktop.
Save paul/14475 to your computer and use it in GitHub Desktop.
irb(main):002:0> require 'uuidtools'
=> true
irb(main):003:0> id = UUID.random_create
=> #<UUID:0x-243e2990 UUID:2ed4542b-52ec-4f8e-b166-1514874bb169>
irb(main):004:0> things = {}
=> {}
irb(main):005:0> things[id] = "foo"
=> "foo"
irb(main):006:0> things[id]
=> "foo"
irb(main):007:0> id = [UUID.random_create]
=> [#<UUID:0x-243e7f94 UUID:9754692d-75fa-4c85-b79a-65f0d0ad6d50>]
irb(main):008:0> things[id] = "foo"
RangeError: bignum too big to convert into `long'
from (irb):8:in `hash'
from (irb):8:in `[]='
from (irb):8
irb(main):009:0> things[[id.to_s]] = "foo"
=> "foo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment