Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: michaeldv/awesome_print
base: 10efa1d60a
...
head fork: michaeldv/awesome_print
compare: 66a77b4847
  • 4 commits
  • 25 files changed
  • 0 commit comments
  • 1 contributor
View
11 CHANGELOG
@@ -1,3 +1,14 @@
+1.1.0
+ - Objects are no longer recursively formatted by default. Reenable by using :raw => true option.
+ - ap(object) now returns nil when running under IRB or Pry
+ - Added support for Mongoid 3 and Moped (Nikolaj Nikolajsen)
+ - Improved formatting of MongoMapper objects (George .)
+ - ActiveRecord::Relation now renders as array (Dan Lynn)
+ - Formatting BigDecimal no longer looses precision (Evan Senter)
+ - Added AwesomePrint.irb! and AwesomePrint.pry! convenience methods
+ - Fixed conflict with the colorize gem
+ - Misc tweaks and bug fixes
+
1.0.2
- Added formatting of Mongoid documents (Adam Doppelt)
- ActiveRecord objects display attributes only. Use :raw => true to display the entire object
View
2  LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2010-2011 Michael Dvorkin
+Copyright (c) 2010-2012 Michael Dvorkin
twitter.com/mid
%w(mike dvorkin.net) * "@" || %w(mike fatfreecrm.com) * "@"
View
12 README.md
@@ -22,6 +22,7 @@ Default options:
:html => false, # Use ANSI color codes rather than HTML.
:multiline => true, # Display in multiple lines.
:plain => false, # Use colors.
+ :raw => false, # Do not recursively format object instance variables.
:sort_keys => false, # Do not sort hash keys.
:limit => false, # Limit large output for arrays and hashes. Set to a boolean or integer.
:color => {
@@ -293,29 +294,36 @@ For example:
* Make your feature addition or bug fix.
* Add specs for it, making sure $ rake spec is all green.
* Commit, do not mess with rakefile, version, or history.
-* Send me a pull request.
+* Send me commit URL (*do not* send me pull requests).
### Contributors ###
* Adam Doppelt -- https://github.com/gurgeous
* Andrew O'Brien -- https://github.com/AndrewO
* Andrew Horsman -- https://github.com/basicxman
+* Barry Allard -- https://github.com/steakknife
* Benoit Daloze -- http://github.com/eregon
* Brandon Zylstra -- https://github.com/brandondrew
+* Dan Lynn -- https://github.com/danlynn
* Daniel Johnson -- https://github.com/adhd360
* Daniel Bretoi -- http://github.com/danielb2
* Eloy Duran -- http://github.com/alloy
* Elpizo Choi -- https://github.com/fuJiin
+* Evan Senter -- https://github.com/evansenter
+* George . -- https://github.com/gardelea
* Greg Weber -- https://github.com/gregwebs
* Jeff Felchner -- https://github.com/jfelchner
+* Nikolaj Nikolajsen -- https://github.com/nikolajsen
+* Ryan Schlesinger -- https://github.com/ryansch
* Sean Gallagher -- http://github.com/torandu
* Stephan Hagemann -- https://github.com/shageman
* Tim Harper -- http://github.com/timcharper
* Tobias Crawley -- http://github.com/tobias
+* Thibaut Barrère -- https://github.com/thbar
* Viktar Basharymau -- https://github.com/DNNX
### License ###
-Copyright (c) 2010-2011 Michael Dvorkin
+Copyright (c) 2010-2012 Michael Dvorkin
twitter.com/mid
View
2  awesome_print.gemspec
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/ap.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/core_ext/array.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/core_ext/class.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/core_ext/kernel.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/core_ext/logger.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/core_ext/method.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/core_ext/object.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/core_ext/string.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/ext/action_view.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/ext/active_record.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/ext/active_support.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/ext/mongo_mapper.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/ext/mongoid.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  lib/awesome_print/ext/nokogiri.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
9 lib/awesome_print/formatter.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
@@ -61,8 +61,11 @@ def colorize(str, type)
# Catch all method to format an arbitrary object.
#------------------------------------------------------------------------------
def awesome_self(object, type)
- return awesome_object(object) if object.instance_variables.any?
- colorize(object.inspect.to_s, type)
+ if @options[:raw] && object.instance_variables.any?
+ awesome_object(object)
+ else
+ colorize(object.inspect.to_s, type)
+ end
end
# Format an array.
View
3  lib/awesome_print/inspector.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
@@ -59,6 +59,7 @@ def initialize(options = {})
:html => false, # Use ANSI color codes rather than HTML.
:multiline => true, # Display in multiple lines.
:plain => false, # Use colors.
+ :raw => false, # Do not recursively format object instance variables.
:sort_keys => false, # Do not sort hash keys.
:limit => false, # Limit large output for arrays and hashes. Set to a boolean or integer.
:color => {
View
2  lib/awesome_print/version.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
2  rails/init.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php
View
16 spec/objects_spec.rb
@@ -1,6 +1,6 @@
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
-describe "Single method" do
+describe "Objects" do
before do
stub_dotfile!
end
@@ -9,7 +9,7 @@
Object.instance_eval{ remove_const :Hello } if defined?(Hello)
end
- describe "object" do
+ describe "Formatting an object" do
it "attributes" do
class Hello
attr_reader :abra
@@ -21,7 +21,8 @@ def initialize
end
end
- out = Hello.new.ai(:plain => true)
+ hello = Hello.new
+ out = hello.ai(:plain => true, :raw => true)
str = <<-EOS.strip
#<Hello:0x01234567
attr_accessor :dabra = 3,
@@ -30,6 +31,7 @@ def initialize
>
EOS
out.gsub(/0x([a-f\d]+)/, "0x01234567").should == str
+ hello.ai(:plain => true, :raw => false).should == hello.inspect
end
it "instance variables" do
@@ -39,7 +41,8 @@ def initialize
end
end
- out = Hello.new.ai(:plain => true)
+ hello = Hello.new
+ out = hello.ai(:plain => true, :raw => true)
str = <<-EOS.strip
#<Hello:0x01234567
@abra = 1,
@@ -48,6 +51,7 @@ def initialize
>
EOS
out.gsub(/0x([a-f\d]+)/, "0x01234567").should == str
+ hello.ai(:plain => true, :raw => false).should == hello.inspect
end
it "attributes and instance variables" do
@@ -62,7 +66,8 @@ def initialize
end
end
- out = Hello.new.ai(:plain => true)
+ hello = Hello.new
+ out = hello.ai(:plain => true, :raw => true)
str = <<-EOS.strip
#<Hello:0x01234567
@doo = 1,
@@ -74,6 +79,7 @@ def initialize
>
EOS
out.gsub(/0x([a-f\d]+)/, "0x01234567").should == str
+ hello.ai(:plain => true, :raw => false).should == hello.inspect
end
end
end
View
2  spec/spec_helper.rb
@@ -1,4 +1,4 @@
-# Copyright (c) 2010-2011 Michael Dvorkin
+# Copyright (c) 2010-2012 Michael Dvorkin
#
# Awesome Print is freely distributable under the terms of MIT license.
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php

No commit comments for this range

Something went wrong with that request. Please try again.