Skip to content

Commit

Permalink
Don't awesome print Capybara elements.
Browse files Browse the repository at this point in the history
Capybara elements are huge and take quite a long time to output.
One pretty much never wants to awesome print them.

/ht @nathanaelkane
  • Loading branch information
jasoncodes committed Nov 20, 2012
1 parent f1149dc commit e889521
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pryrc
Expand Up @@ -43,8 +43,13 @@ org_print = Pry.config.print
Pry.config.print = proc do |output, value| Pry.config.print = proc do |output, value|
begin begin
require 'awesome_print' require 'awesome_print'
value = value.to_a if defined?(ActiveRecord) && defined?(ActiveRecord::Relation) && value.is_a?(ActiveRecord::Relation) case
output.puts value.ai when defined?(Capybara) && value.is_a?(Capybara::Node::Element)
org_print.call(output, value)
else
value = value.to_a if defined?(ActiveRecord) && defined?(ActiveRecord::Relation) && value.is_a?(ActiveRecord::Relation)
output.puts value.ai
end
rescue LoadError => err rescue LoadError => err
org_print.call(output, value) org_print.call(output, value)
end end
Expand Down

0 comments on commit e889521

Please sign in to comment.