Skip to content

Instantly share code, notes, and snippets.

@Toady00
Created April 2, 2013 19:48
Show Gist options
  • Save Toady00/5295575 to your computer and use it in GitHub Desktop.
Save Toady00/5295575 to your computer and use it in GitHub Desktop.
Testing out passing values.
class DupTest
def initialize(options = {})
options = options.dup
options[:from_init] = true
puts options
end
end
# => nil
options = {from_init: false}
# => {:from_init=>false}
DupTest.new options
{:from_init=>true}
# => #<DupTest:0x007ff89985be18>
puts options
{:from_init=>false}
# => nil
class DupTest
def initialize(options = {})
options[:from_init] = true
puts options
end
end
# => nil
puts options
{:from_init=>false}
# => nil
DupTest.new options
{:from_init=>true}
# => #<DupTest:0x007ff89982f048>
puts options
{:from_init=>true}
# => nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment