It's not really worth explaining what the script is doing, but I made the method to take out the . and .. from an array that is populated by Dir.entries().
class Array
#this is a method to remove current directory and parent directory from an array
def crop
self.delete('.')
self.delete('..')
end
end
log_path = 'C:/Users/arromeo/AppData/Roaming/.purple/logs/aim/myscreenname'
Dir.chdir(log_path)
chat_partners = Dir.entries('.').crop
puts chat_partners
When I run the code like this, the output is simply:
..
Not sure why that happens. If I switch the code to read:
chat_partners = Dir.entries('.')
chat_partners.crop
puts chat_partners
...it outputs correctly. Why does this happen?
This post has been edited by pareidolia: 13 November 2010 - 11:45 AM

New Topic/Question
Reply




MultiQuote





|