# File lib/main/base.rb, line 4 def wrap_run! const_set :RUN, instance_method(:run) class_eval do def run *a, &b argv.push "--#{ argv.shift }" if argv.first == 'help' return mode_run! if mode_given? status = catch :exit do begin parse_parameters if params['help'] and params['help'].given? print usage.to_s exit end pre_run before_run self.class.const_get(:RUN).bind(self).call(*a, &b) after_run post_run finalize rescue Exception => e handle_exception e end nil end handle_throw status end end end