Browse files

Add article: ruby: log return value

  • Loading branch information...
1 parent 82a2c5c commit 83ee3025495f8a8df1a47b7412f61479ee262465 @shir committed Aug 2, 2011
Showing with 16 additions and 0 deletions.
  1. +16 −0 source/_posts/2011-08-02-log-return-value.markdown
View
16 source/_posts/2011-08-02-log-return-value.markdown
@@ -0,0 +1,16 @@
+---
+layout: post
+title: "Ruby: Log return value"
+date: 2011-08-02 14:55
+comments: true
+categories: ruby
+---
+
+Если вам нужно вывести в лог возврщаемое из функции значение то можно
+воспользоваться методом [tap()](http://apidock.com/ruby/Object/tap):
+
+``` ruby
+ def some_function
+ complex_calculation.tap{ |v| Rails.logger.debug "returnd value = #{v}" }
+ end
+```

0 comments on commit 83ee302

Please sign in to comment.