1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Add Pry::CommandContext#text

This commit is contained in:
Rob Gleeson 2011-05-06 18:28:12 +01:00
parent 495e00caa7
commit 26d584b55b
3 changed files with 8 additions and 3 deletions

View file

@ -23,8 +23,13 @@ class Pry
command_set.commands command_set.commands
end end
def text
@text ||= Class.new do
extend Pry::Helpers::Color
end
end
include Pry::Helpers::BaseHelpers include Pry::Helpers::BaseHelpers
include Pry::Helpers::CommandHelpers include Pry::Helpers::CommandHelpers
include Pry::Helpers::Color
end end
end end

View file

@ -27,7 +27,7 @@ class Pry
history.each_with_index do |element, index| history.each_with_index do |element, index|
if element =~ pattern if element =~ pattern
output.puts "#{blue index}: #{element}" output.puts "#{text.blue index}: #{element}"
end end
end end
end end

View file

@ -27,7 +27,7 @@ class Pry
line_array = lines.each_line.to_a line_array = lines.each_line.to_a
line_array.each_with_index.map do |line, idx| line_array.each_with_index.map do |line, idx|
adjusted_index = idx + start_line adjusted_index = idx + start_line
"#{blue adjusted_index}: #{line}" "#{text.blue adjusted_index}: #{line}"
end.join end.join
end end