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 [Fixnum] offset
|
||||
# @return [String]
|
||||
def with_line_numbers text, offset
|
||||
def with_line_numbers(text, offset, color=:blue)
|
||||
lines = text.each_line.to_a
|
||||
lines.each_with_index.map do |line, index|
|
||||
adjusted_index = index + offset
|
||||
"#{self.blue adjusted_index}: #{line}"
|
||||
"#{self.send(color, adjusted_index)}: #{line}"
|
||||
end.join
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue