Class: Cuporter::Formatters::Text

Inherits:
Writer
  • Object
show all
Includes:
TextMethods
Defined in:
lib/cuporter/formatters/text.rb

Constant Summary collapse

COL_WIDTH =
5

Instance Method Summary collapse

Methods included from TextMethods

#write, #write_node

Methods inherited from Writer

#initialize

Constructor Details

This class inherits a constructor from Cuporter::Formatters::Writer

Instance Method Details

#line(number, line) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/cuporter/formatters/text.rb', line 12

def line(number, line)
  if @number_scenarios
    number_string = number ? "#{number}." : ""
    number_field = number_string.rjust(COL_WIDTH, " ")
    line.sub!(/^\s{#{COL_WIDTH}}/, number_field)
  end
  line
end

#tabObject



7
8
9
# File 'lib/cuporter/formatters/text.rb', line 7

def tab
  @tab ||= @number_scenarios ? "   " : "  "
end