Created
April 2, 2013 19:48
-
-
Save Toady00/5295575 to your computer and use it in GitHub Desktop.
Testing out passing values.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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