From: Heesob Park Date: 2008-04-10T19:11:30+09:00 Subject: Re: Executing class methods Hi, Clement Ow wrote: > class MainLogic > def archive > sd_a=$del_path.zip($del_selection) > puts sd_a > sd_a.each do |sd| > $del_path, $del_selection = sd > del = File.join $del_path, $del_selection > puts "Files to be deleted: #{del}" > > #Dir.chdir($del_path) > > FileUtils.rm_r Dir.glob(del) > end #each > end # archive > end #MainLogic > > MainLogic.archive > > Hi (again), > > I wanna run the class method but somehow an error occured saying' > testing.rb:64: undefined method `archive' for MainLogic:Class > (NoMethodError)' > Is there anything wrong with my code or structure? archive must be Singleton method. Modify like this will work: class MainLogic def MainLogic.archive ... end # archive end #MainLogic Or class MainLogic class << self def archive ... end # archive end end #MainLogic Regards, Park Heesob -- Posted via http://www.ruby-forum.com/.