Created
March 18, 2011 10:50
-
-
Save tcrayford/875889 to your computer and use it in GitHub Desktop.
Ruby's structs can lead to weird nils
This file contains hidden or 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
irb(main):001:0> Month = Struct.new(:year, :month) | |
=> Month | |
irb(main):002:0> Month.new(1) | |
=> #<struct Month year=1, month=nil> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment