Class: Pork::Description

Inherits:
Dot show all
Defined in:
lib/pork/report/description.rb

Instance Attribute Summary collapse

Attributes inherited from Report

#io

Instance Method Summary collapse

Instance Attribute Details

#last_executorObject

Returns the value of attribute last_executor.



6
7
8
# File 'lib/pork/report/description.rb', line 6

def last_executor
  @last_executor
end

Instance Method Details

#case_endObject



35
36
37
# File 'lib/pork/report/description.rb', line 35

def case_end
  io.puts
end

#case_start(context) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pork/report/description.rb', line 21

def case_start context
  self.last_executor ||= Executor
  executor = context.class
  levels = executor.ancestors.drop(1).count{ |a| a <= Executor }

  if executor != Executor && last_executor != executor
    io.puts "#{'  ' * (levels - 1)}#{executor.desc}"
  end

  io.print "#{'  ' * levels}#{context.pork_description}"

  self.last_executor = executor
end

#msg_erroredObject



19
# File 'lib/pork/report/description.rb', line 19

def msg_errored; "\e[1G#{super}"; end

#msg_failedObject



18
# File 'lib/pork/report/description.rb', line 18

def msg_failed ; "\e[1G#{super}"; end

#msg_passObject



8
9
10
11
12
13
14
15
# File 'lib/pork/report/description.rb', line 8

def msg_pass
  msg = "\e[1Go"
  if respond_to?(:green, true)
    green(msg)
  else
    msg
  end
end

#msg_skipObject



17
# File 'lib/pork/report/description.rb', line 17

def msg_skip   ; "\e[1G#{super}"; end