As defined, archive is an instance method.

try changing
def archive

to
def self.archive

or

def MainLogic.archive

To make it a class method.

RF

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?