class TheFox::TermKit::App

Attributes

logger[RW]

Public Class Methods

new() click to toggle source
# File lib/termkit/app/app.rb, line 11
def initialize
    @exit = false
    
    @logger = Logger.new('termkit_app.log')
    @logger.level = Logger::DEBUG
end

Public Instance Methods

run() click to toggle source

Calls run_cycle() in a loop.

# File lib/termkit/app/app.rb, line 20
def run
    #puts 'App run'
    
    loop_cycle = 0
    while !@exit
        loop_cycle += 1
        
        run_cycle
        #sleep @run_cycle_sleep
    end
end
run_cycle() click to toggle source

As single cycle of run().

# File lib/termkit/app/app.rb, line 34
def run_cycle
    #puts 'App run_cycle'
end
terminate() click to toggle source

Call this to terminate the App.

# File lib/termkit/app/app.rb, line 40
def terminate
    if !@exit
        # puts 'App->terminate'
        
        @exit = true
        
        app_will_terminate
    end
end

Protected Instance Methods

app_will_terminate() click to toggle source

This can be implemented by a sub-class of App.

# File lib/termkit/app/app.rb, line 54
def app_will_terminate
    # puts 'App->app_will_terminate'
end