Class: Bickle::ColorDecorator

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/bickle/color_decorator.rb

Instance Method Summary collapse

Constructor Details

#initialize(build, shell) ⇒ ColorDecorator

Returns a new instance of ColorDecorator.



3
4
5
6
7
# File 'lib/bickle/color_decorator.rb', line 3

def initialize(build, shell)
  @build = build
  @shell = shell
  super(@build)
end

Instance Method Details

#resultObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/bickle/color_decorator.rb', line 9

def result
  res = @build.result

  if @build.pass?
    @shell.set_color(res, :green)
  elsif @build.fail?
    @shell.set_color(res, :red)
  else
    @shell.set_color(res, :yellow)
  end
end