[Comment] Re: Iterating over a Hash in Ruby

0
Yep, cool. Thanks, Tony!
irb(main):043:0> h1.each{|k,v| puts "#{k} ---> #{v}"}
a ---> 1
b ---> 2
c ---> 3
=> {"a"=>1, "b"=>2, "c"=>3}

This reminds me of something else that has been bugging me since I saw it. What does this syntax mean?

def list
  @category_pages, @categories = paginate :category, :per_page => 10, :order_by => 'category'
end

How can Ruby return two values from the paginate method?!

Leave a Reply

Your email address will not be published. Required fields are marked *

CommentLuv badge