From 8044d58a518d1ba13eaf87e8385728bc649b6eda Mon Sep 17 00:00:00 2001 From: Mike Dvorkin Date: Mon, 5 Apr 2010 21:21:57 -0700 Subject: [PATCH] Release 0.1.2 --- README.md | 83 +++++++++++++++++++++++---------------- VERSION | 2 +- awesome_print.gemspec | 4 +- lib/ap/core_ext/string.rb | 2 +- 4 files changed, 54 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 6a07e39..fd8ec36 100644 --- a/README.md +++ b/README.md @@ -14,38 +14,43 @@ objects are supported via included mixin. $ git clone git://github.com/michaeldv/awesome_print_.git ### Usage ### + require "ap" - ap(object, options = {}) + ap object, options = {} - Default options: - :miltiline => true, - :plain => false, - :indent => 4, - :colors => { - :array => :white, - :bignum => :blue, - :class => :yellow, - :date => :greenish, - :falseclass => :red, - :fixnum => :blue, - :float => :blue, - :hash => :gray, - :nilclass => :red, - :string => :yellowish, - :symbol => :cyanish, - :time => :greenish, - :trueclass => :green - } +Default options: - Supported color names: - :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white - :black, :redish, :greenish, :yellowish, :blueish, :purpleish, :cyanish, :pale + :miltiline => true, + :plain => false, + :indent => 4, + :colors => { + :array => :white, + :bignum => :blue, + :class => :yellow, + :date => :greenish, + :falseclass => :red, + :fixnum => :blue, + :float => :blue, + :hash => :gray, + :nilclass => :red, + :string => :yellowish, + :symbol => :cyanish, + :time => :greenish, + :trueclass => :green + } -### Example (IRB) ### - $ irb - irb> require "ap" - irb> data = [ false, 42, %w(fourty two), { :now => Time.now, :class => Time.now.class, :distance => 42e42 } ] - irb> ap data +Supported color names: + + :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white + :black, :redish, :greenish, :yellowish, :blueish, :purpleish, :cyanish, :pale + +### Examples ### + $ cat > 1.rb + require "ap" + data = [ false, 42, %w(fourty two), { :now => Time.now, :class => Time.now.class, :distance => 42e42 } ] + ap data + ^D + $ ruby 1.rb [ [0] false, [1] 42, @@ -59,17 +64,29 @@ objects are supported via included mixin. :distance => 4.2e+43 } ] - irb> ap data[3], :indent => -2 # Left align hash keys. + + $ cat > 2.rb + require "ap" + data = { :now => Time.now, :class => Time.now.class, :distance => 42e42 } + ap data, :indent => -2 # <-- Left align hash keys. + ^D + $ ruby 2.rb { :class => Time < Object, :now => Fri Apr 02 19:55:53 -0700 2010, :distance => 4.2e+43 } - irb> ap data, :multiline => false - [ false, 42, [ "fourty", "two" ], { :class => Time < Object, :distance => 4.2e+43, :now => Fri Apr 02 19:44:52 -0700 2010 } ] - irb> -### Example (Rails) ### + $ cat > 3.rb + require "ap" + data = [ false, 42, %w(fourty two) ] + data << data # <-- Nested array. + ap data, :multiline => false + ^D + $ ruby 3.rb + [ false, 42, [ "fourty", "two" ], [...] ] + +### Example (Rails console) ### $ ruby script/console Loading development environment (Rails 2.3.5) rails> require "ap" diff --git a/VERSION b/VERSION index 17e51c3..d917d3e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.1 +0.1.2 diff --git a/awesome_print.gemspec b/awesome_print.gemspec index bd96837..9262a24 100644 --- a/awesome_print.gemspec +++ b/awesome_print.gemspec @@ -5,11 +5,11 @@ Gem::Specification.new do |s| s.name = %q{awesome_print} - s.version = "0.1.1" + s.version = "0.1.2" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Michael Dvorkin"] - s.date = %q{2010-04-04} + s.date = %q{2010-04-05} s.description = %q{Great Ruby dubugging companion: pretty print Ruby objects to visualize their structure. Supports Rails ActiveRecord objects via included mixin.} s.email = %q{mike@dvorkin.net} s.extra_rdoc_files = [ diff --git a/lib/ap/core_ext/string.rb b/lib/ap/core_ext/string.rb index 3464fdc..4b8d29c 100755 --- a/lib/ap/core_ext/string.rb +++ b/lib/ap/core_ext/string.rb @@ -3,7 +3,7 @@ # Awesome Print is freely distributable under the terms of MIT license. # See LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ -class String # :nodoc: +class String [ :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white ].each_with_index do |color, i| if STDOUT.tty? && ENV['TERM'] && ENV['TERM'] != 'dumb'