Skip to content

Instantly share code, notes, and snippets.

@salzig
Created September 5, 2012 13:24
Show Gist options
  • Save salzig/3636465 to your computer and use it in GitHub Desktop.
Save salzig/3636465 to your computer and use it in GitHub Desktop.
Oh why? O.o
> a = Hash.new(Hash.new(0))
=> {}
> a[DateTime.now.beginning_of_day]["abc"] = 13
=> 13
> a[DateTime.now.beginning_of_day]["abc"]
=> 13
> a[DateTime.now.beginning_of_day]
=> {"abc"=>13}
> a
=> {}
> a[DateTime.now.beginning_of_day] = {}
=> {}
> a[DateTime.now.beginning_of_day]["abc"] = 13
=> 13
> a
=> {Wed, 05 Sep 2012 00:00:00 +0200=>{"abc"=>13}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment