Topic: Ruby Programming Help! :)

Hey everyone! I just started Ruby today (about 2 full hours now) and I've gotta say, I really love it! It's easy to follow, and quite interesting to say the least.

I ran into a little bit of a problem, and I've been searching for the answer for quite a while now but to no avail, and was wondering if I get pointed in the right direction.

I've created a little script that will eventually be blocking application's based upon their unique application id's. Also, although no functionality yet, I also intend to have a whitelist of allowed applications, even if entered to be blocked.

Here's the script so far:

#!/usr/bin/env ruby

whitelist = ['1','2']

puts <<START 
Enter the Application ID\'s that you want to check for.
Multiple application ID\'s must be in a ruby array format.
Ex: ['3214846573218','984919874676159','987941963464684']

Both the brackets [ and ] as well as the apostrophe\'s and commas
are essential. Do not forget them or this application will fail!
START

appid = gets.chomp

puts <<START
Below are the application ID\'s that you entered, ensure they\'re
correct before you continue. \n
START
puts appid

puts "These application id\'s will be blocked, continue? Y/N "
result = gets.chomp

if result == ['y','Y','yes','Yes'] #Here is my problem!
   puts 'Blocking applications now....'
else
   puts 'Canceled...'
end

So as you can see (http://d.pr/OwbF) the script executes just fine! Which is pretty cool. haha. The script even is able to 'puts' the information provided by the user (http://d.pr/SXyz). However when asking the continue question the script get's hung up! Instead of y and Y continue to 'puts' "Blocking applications now....." it reads any input as 'puts' "Canceled...." (http://d.pr/AeVo)

This obviously makes me a sad panda, and makes me think that my string 'result' is anything other than 'y,Y,yes,Yes'.

Any tips, advice, tricks?

Re: Ruby Programming Help! :)

if ['y','Y','yes','Yes'].include?(result)

Joe got a job, on the day shift, at the Utility Muffin Research Kitchen, arrogantly twisting the sterile canvas snout of a fully charged icing anointment utensil.

Re: Ruby Programming Help! :)

Very cool! Worked like a charm. Unfortunately I was unable to locate that method anywhere, so I really appreciate your help! smile

Re: Ruby Programming Help! :)

hello,
i want to learn ruby , but actually i don't have any good software dev. back ground
may i learn ruby, if so, plz.,inform recomanded books, practices,conventions
where i can get the ruby version to install in my laptop to practice, how to install??
how is the remote work opportunities to ruby, ruby on rails in future?????
oooohhhh long question!!!!!!!!!!, but plz., help..
thanks