class ScTimer

Public Class Methods

new() click to toggle source
# File lib/ScreenTimer.rb, line 206
def initialize()
        @count = 0
        @countup = true
        loop do
                print %Q{Which will you use? [count up(up) / count down(down)]: }
                md = STDIN.gets
                if md =~ /up$/ then
                        @countup = true
                        break
                elsif md =~ /down$/ then
                        @countup = false
                        break
                else
                        print %Q{\nInvailid value entered.\n}
                        print %Q{exit? [y/n]: }
                        if STDIN.gets =~ /^y/ then
                                exit 0
                        end
                end
        end
end

Public Instance Methods

count() click to toggle source
# File lib/ScreenTimer.rb, line 242
def count()
        ccounter = CursesCounter.new(@countup,@count)
        ccounter.start
        ccounter.timerend
end
countup?() click to toggle source
# File lib/ScreenTimer.rb, line 237
def countup?()
        return @countup
end
setcounter(counts) click to toggle source
# File lib/ScreenTimer.rb, line 228
def setcounter(counts)
        if counts.class == Fixnum  and counts >= 0 then
                @count = counts
        else
                raise(ArgumentError,"Invailid value.")
        end
end