fedzor
6/17/2008 12:39:00 AM
As you accurately spotted, it's with your if-statements.
On Jun 16, 2008, at 8:15 PM, Chance Dinkins wrote:
> def parse_Requests(requests)
> output = Array.new
> requests.each{|item|
> if(FileTest.exist?(item))
Starts an if
> if FileTest.directory?(item)?output << parse_Dir(item) :
> output <<
> parse_File(item)
Starts an If
> else
> output << parse_error(item)
> end
Ends an if
> }
> end
with this line here:
> if FileTest.directory?(item)?output << parse_Dir(item) :
> output <<
> parse_File(item)
You are trying to do a ternary operator. however, you are starting it
with an if!
Try this:
FileTest.directory?(item) ? output << parse_Dir(item) : output <<
parse_File(item)
Feel free to put in spaces (the code looked convoluted, at least to
me), and you don't need all those parenthesis!
Lose the shoes, and try on some (ruby) slippers!
ari
--------------------------------------------|
If you're not living on the edge,
then you're just wasting space.