Last active
August 29, 2015 14:01
-
-
Save jefflunt/c382083c7b8853974437 to your computer and use it in GitHub Desktop.
Handling hashes
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
> text = 'some text' | |
=> "some text" | |
> hash_options = {rant_id:1,date:11/04/2014,top:text,number:12} | |
=> {:rant_id=>1, :date=>0, :top=>"some text", :number=>12} | |
NOTE that 'date' gets set to zero, because it's being interpreted as, "11 divided by 04 divided by 2014" | |
Also this: | |
> hash_options = rant_id:1,date:11/04/2014,top:text,number:12 | |
SyntaxError: (irb):5: syntax error, unexpected tLABEL | |
hash_options = rant_id:1,date:11/04/2014,top:text,number:12 | |
^ | |
As opposed to this: | |
> hash_options = {rant_id:1,date:11/04/2014,top:text,number:12} | |
=> {:rant_id=>1, :date=>0, :top=>"some text", :number=>12} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment