C
Chance Dinkins
Hey guys, I'm just getting my feet wet with Ruby (trying to learn the
syntax before jumping off into RoR) but I'm having some difficulty with
the parser understanding the order of operation..
I have the following code:
def parse_Requests(requests)
output = Array.new
requests.each{|item|
if(FileTest.exist?(item))
if FileTest.directory?(item)?output << parse_Dir(item) : output <<
parse_File(item)
else
output << parse_error(item)
end
}
end
but I am getting the following errors:
ls.rb:31: syntax error, unexpected '}', expecting kEND
ls.rb:37: syntax error, unexpected $end, expecting kEND
it seems like once I breach the typical 1 liner for the each block that
it throws a fit. If this is the case, how do I navigate around it? If
its not the case, did I screw up on the logic somewhere? I'm not used to
using end to kill an if / else block so I guess I could have goofed
there..
Thanks for the help!
syntax before jumping off into RoR) but I'm having some difficulty with
the parser understanding the order of operation..
I have the following code:
def parse_Requests(requests)
output = Array.new
requests.each{|item|
if(FileTest.exist?(item))
if FileTest.directory?(item)?output << parse_Dir(item) : output <<
parse_File(item)
else
output << parse_error(item)
end
}
end
but I am getting the following errors:
ls.rb:31: syntax error, unexpected '}', expecting kEND
ls.rb:37: syntax error, unexpected $end, expecting kEND
it seems like once I breach the typical 1 liner for the each block that
it throws a fit. If this is the case, how do I navigate around it? If
its not the case, did I screw up on the logic somewhere? I'm not used to
using end to kill an if / else block so I guess I could have goofed
there..
Thanks for the help!