Module: Cuporter::Formatters::Text
Constant Summary
collapse
- SPACER =
" "
Instance Method Summary
collapse
Methods included from Util
depth, terminal_width
build_line, dir, example, example_header, examples, feature, file, report, scenario, scenario_outline, tag
Instance Method Details
#blank_for_number(node) ⇒ Object
127
128
129
130
131
|
# File 'lib/cuporter/formatters/text.rb', line 127
def blank_for_number(node)
l = tab_stop * depth(node)
l += SPACER if node.document.at("[@number]")
l
end
|
#cuke_name(value) ⇒ Object
132
133
134
135
|
# File 'lib/cuporter/formatters/text.rb', line 132
def cuke_name(value)
return "" unless value
value.unescape_apostrophe
end
|
#example_name(value) ⇒ Object
159
160
161
|
# File 'lib/cuporter/formatters/text.rb', line 159
def example_name(value)
cuke_name value
end
|
#file_path(value, line_size) ⇒ Object
146
147
148
149
|
# File 'lib/cuporter/formatters/text.rb', line 146
def file_path(value, line_size)
return "" unless value
"#{tab_stop}##{value}#{tab_stop * 2}".rjust(terminal_width - line_size)
end
|
118
119
120
121
122
123
124
125
126
|
# File 'lib/cuporter/formatters/text.rb', line 118
def format_number(node, attr)
d = depth(node)
indent_length = d * tab_stop.size
if ( value = node[attr])
yield(indent_length, value)
else
tab_stop * d
end
end
|
#fs_name(value) ⇒ Object
136
137
138
139
|
# File 'lib/cuporter/formatters/text.rb', line 136
def fs_name(value)
return "" unless value
value.upcase
end
|
#normal_indent(node) ⇒ Object
155
156
157
|
# File 'lib/cuporter/formatters/text.rb', line 155
def normal_indent(node)
tab_stop * depth(node)
end
|
#number(node) ⇒ Object
112
113
114
115
116
|
# File 'lib/cuporter/formatters/text.rb', line 112
def number(node)
format_number(node, 'number') do |indent_length, value|
"%#{tab_stop}#{indent_length}s " % "#{value}."
end
end
|
#tab_stop ⇒ Object
98
99
100
|
# File 'lib/cuporter/formatters/text.rb', line 98
def tab_stop
@@tab_stop ||= SPACER * 2
end
|
141
142
143
144
|
# File 'lib/cuporter/formatters/text.rb', line 141
def tags(value)
return "" unless value
"#{tab_stop * 2}#{value}"
end
|
#title(value) ⇒ Object
151
152
153
|
# File 'lib/cuporter/formatters/text.rb', line 151
def title(value)
value || ""
end
|
#total(node) ⇒ Object
106
107
108
109
110
|
# File 'lib/cuporter/formatters/text.rb', line 106
def total(node)
format_number(node, 'total') do |indent_length, value|
"[#{value}]".ljust(indent_length, SPACER)
end
end
|
#total_column_spacer ⇒ Object
102
103
104
|
# File 'lib/cuporter/formatters/text.rb', line 102
def total_column_spacer
@@total_column_spacer ||= NodeFormatters.total ? tab_stop : ""
end
|