Module: BuildTool::History::StateHelper

Included in:
CommandLog, ModuleLog
Defined in:
lib/build-tool/history.rb

Defined Under Namespace

Modules: ClassMethods

Constant Summary collapse

STARTED =

Needed for both Module and Command History

0
CANCELED_BY_USER =
1
FINISHED_SUCCESSFUL =
2
FINISHED_WITH_ERRORS =
3

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



41
42
43
# File 'lib/build-tool/history.rb', line 41

def self.included( klass )
    klass.extend ClassMethods
end

Instance Method Details

#state_strObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/build-tool/history.rb', line 23

def state_str
    case self.state
    when STARTED
        "STARTED"
    when CANCELED_BY_USER
        ANSI::Code.red { "CANCELED" }
    when FINISHED_SUCCESSFUL
        ANSI::Code.green { "SUCCESS" }
    when FINISHED_WITH_ERRORS
        ANSI::Code.red { "ERRORS" }
    else
        "#{self.state.to_s}?"
    end
end