class TheFox::Timr::Status

Used as [Task](TheFox::Timr::Model::Task) and [Track](TheFox::Timr::Model::Track) Status.

Attributes

long_status[R]

Resolved by `short_status`. See `set_long_status` method.

short_status[R]

Source Data

Public Class Methods

new(short_status) click to toggle source
# File lib/timr/status.rb, line 24
def initialize(short_status)
        @short_status = short_status
        
        @long_status = nil
        set_long_status
end

Public Instance Methods

colorized() click to toggle source

Use `term/ansicolor` to colorize the Long Status.

# File lib/timr/status.rb, line 32
def colorized
        case @short_status
        when ?R
                green(@long_status)
        when ?S
                red(@long_status)
        else
                @long_status
        end
end
to_s() click to toggle source

To String

# File lib/timr/status.rb, line 44
def to_s
        long_status
end

Private Instance Methods

set_long_status() click to toggle source
# File lib/timr/status.rb, line 50
def set_long_status
        @long_status = case @short_status
                when ?-
                        'not started'
                when ?R
                        'running'
                when ?S
                        'stopped'
                when ?P
                        'paused'
                when ?U
                        'unknown'
                else
                        'unknown'
                end
end