Skip to content

Instantly share code, notes, and snippets.

@Fosome
Created November 20, 2012 20:48
Show Gist options
  • Save Fosome/4120989 to your computer and use it in GitHub Desktop.
Save Fosome/4120989 to your computer and use it in GitHub Desktop.
ruby-1.9.3-p0 :011 > base = {:a => "a", :b => "b"}
=> {:a=>"a", :b=>"b"}
ruby-1.9.3-p0 :012 > other = base
=> {:a=>"a", :b=>"b"}
ruby-1.9.3-p0 :013 > other[:c] = "c"
=> "c"
ruby-1.9.3-p0 :014 > base
=> {:a=>"a", :b=>"b", :c=>"c"}
ruby-1.9.3-p0 :015 >
#--------------------------
ruby-1.9.3-p0 :015 > other = base.dup
=> {:a=>"a", :b=>"b", :c=>"c"}
ruby-1.9.3-p0 :016 > other[:d] = "d"
=> "d"
ruby-1.9.3-p0 :017 > base
=> {:a=>"a", :b=>"b", :c=>"c"}
ruby-1.9.3-p0 :018 >
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment