1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Merge branch 'master' of git://github.com/shageman/awesome_print into shageman/master

This commit is contained in:
Mike Dvorkin 2011-05-04 17:56:29 -07:00
commit 52bb3e7adb
3 changed files with 17 additions and 0 deletions

View file

@ -129,6 +129,14 @@ Supported color names:
[19] upcase!() String [19] upcase!() String
] ]
$ cat > 6.rb
require "ap"
ap(42 == ap(42))
^D
$ ruby 6.rb
42
true
### Example (Rails console) ### ### Example (Rails console) ###
$ ruby script/console $ ruby script/console
Loading development environment (Rails 2.3.5) Loading development environment (Rails 2.3.5)

View file

@ -13,6 +13,7 @@ module Kernel
def ap(object, options = {}) def ap(object, options = {})
puts object.ai(options) puts object.ai(options)
object
end end
alias :awesome_print :ap alias :awesome_print :ap

View file

@ -7,6 +7,14 @@ describe "AwesomePrint" do
stub_dotfile! stub_dotfile!
end end
describe "ap method" do
it "return value" do
object = rand
self.stub!(:puts)
(ap object).should eql(object)
end
end
describe "Array" do describe "Array" do
before(:each) do before(:each) do
@arr = [ 1, :two, "three", [ nil, [ true, false] ] ] @arr = [ 1, :two, "three", [ nil, [ true, false] ] ]