Good afternoon,
...this is slightly off topic, but i'm also going thru the Apress "Beginning
Ruby" book...i'm finding it to be a really good read...
...are you using a Mac, if so, take a look at 'TextMate' the editor
recommended for the Mac - it's excellent and it doesn't cost much...it
supports both Ruby and Rails...
...i went thru the AWDWR ["Agile Web Devlopment with Rails"] book - but I
found the "Ruby on Rails 3 Tutorial" with an associated screen cast to be
better suited to me...it's a bit expensive, the screen cast and book will
run about $100...
...i'm in chapter 3 with the "Beginning Ruby" book and I hope to finish it
on Wednesday and then get back to Rails...
...i'll take a look at your question on Tuesday...
Good weekend
----- Original Message -----
From: "Patrick Lynch" <>
To: "ruby-talk ML" <ruby->
Sent: Friday, May 27, 2011 6:22 PM
Subject: Variable scopes with code blocks.
> Hello!
>
> Novice here. I'm reading Beginning Ruby and Beginning Rails by Apres and
> building both applications they walk you through. Additionally, I'm
> taking courses at lynda dot com and attempting to build a simple
> application myself.
>
> That said, I'm aware of the limits you have with local variable being
> incapable of accessing variables defined inside of a code block, but is
> there any exception to this rule?
>
> Example:
> _____________
>
> 1.times do
> File.open("text.txt").each {|a| puts a}
> end
>
> puts a
> # This where I get my error.
> _____________
>
> Is there anything I can do to 'puts a' that will allow it to return the
> content it was passed inside of the code block?
>
> Ultimately, I'd like to store the 'text.txt' as an array so I can call
> .uniq! on it... But we don't need to get into that in this thread.
>
> I hope my question makes sense.
>
> Thank you in advanced,
> Aaron
>
> --
> Posted via http://www.ruby-forum.com/.
>
>
>
>