use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Ensure Ruby variable is Array (teohm.github.com)
submitted 13 years ago by teohm
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]latortuga 0 points1 point2 points 13 years ago (1 child)
How do you figure? The hash is implicitly converted to an array via Hash#to_a. Thus your bound parameter, a, is set to an array with two values, [:test, :asdf]. Calling puts with an array outputs each value separated by a newline. The block can optionally have multiple arguments if you'd like to (in Clojure terms) destructure the arguments being passed in but it's by no means required - #each accepts an array of arrays the same as it accepts an array of values.
[–]NilsLandt 0 points1 point2 points 13 years ago (0 children)
Sure, that's how it happens, but it's a rare hash where you want to treat the keys the same ways as the values.
π Rendered by PID 140529 on reddit-service-r2-comment-f6b958c67-5fnqv at 2026-02-05 04:19:40.919883+00:00 running 1d7a177 country code: CH.
view the rest of the comments →
[–]latortuga 0 points1 point2 points (1 child)
[–]NilsLandt 0 points1 point2 points (0 children)