updated with_line_numbers method to accept color parameter
This commit is contained in:
parent
f25542a8af
commit
01b248e296
|
@ -67,11 +67,11 @@ class Pry
|
||||||
# @param [#each_line] text
|
# @param [#each_line] text
|
||||||
# @param [Fixnum] offset
|
# @param [Fixnum] offset
|
||||||
# @return [String]
|
# @return [String]
|
||||||
def with_line_numbers text, offset
|
def with_line_numbers(text, offset, color=:blue)
|
||||||
lines = text.each_line.to_a
|
lines = text.each_line.to_a
|
||||||
lines.each_with_index.map do |line, index|
|
lines.each_with_index.map do |line, index|
|
||||||
adjusted_index = index + offset
|
adjusted_index = index + offset
|
||||||
"#{self.blue adjusted_index}: #{line}"
|
"#{self.send(color, adjusted_index)}: #{line}"
|
||||||
end.join
|
end.join
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue