From: Heesob Park Date: 2009-03-09T18:35:18+09:00 Subject: Re: I code my first ruby script, and it got problem! 2009/3/9 Power One : > What was first a simple stupid script that I try to whip up for practice > is not getting complicated, but it's still a stupid script!  Why?  Linux > already has ways for you to remove, delete, and messing with files > without any help from a wrapper or any external programs!  LOL, but > since I'm a total noob to Ruby, and still learning the syntax, plus I'm > not a programmer, and Ruby is like my first language, and so I dig a > bigger hole to sink in even worse. > > The original script was like 39 lines, and it has now turned into 141 > lines or so. > Updated script is at http://pastie.org/411503. > > Still new errors got introduced!  I don't know how to fix it at this > point.  New error is complaining within the method "file_remove", and > the error is > > /home/geek/My_Ruby_01/TestTheRuby/test/Test_Dir.rb:103:in `list_file': > type mismatch: String given (TypeError) >        from /home/spidy/My_Ruby_01/TestTheRuby/test/Test_Dir.rb:103:in > `file_remove' >        from /home/geek/My_Ruby_01/TestTheRuby/test/Test_Dir.rb:81:in > `del_dir' >        from /home/geek/My_Ruby_01/TestTheRuby/test/Test_Dir.rb:141 > > Anyone dare to give me any advice further? LOL... > def list_file(file) @filex == file while @filex.to_s =~ "ls files" Dir.entries(".").join(' ') end end should be def list_file(file) @filex = file if @filex == "ls files" puts Dir.entries(".").join(' ') end end Regards, Park Heesob