Skip to content

Commit

Permalink
Make ap return the printed object.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Hagemann committed Apr 29, 2011
1 parent 0f14846 commit 05726bf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/ap/core_ext/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def ai(options = {})

def ap(object, options = {})
puts object.ai(options)
object
end
alias :awesome_print :ap

Expand Down
7 changes: 7 additions & 0 deletions spec/awesome_print_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@
stub_dotfile!
end

describe "ap method" do
it "return value" do
object = ""
(ap object).should eql(object)
end
end

describe "Array" do
before(:each) do
@arr = [ 1, :two, "three", [ nil, [ true, false] ] ]
Expand Down

0 comments on commit 05726bf

Please sign in to comment.