lib/rext/object/helpers.rb in visionmedia-rext-0.1.0 vs lib/rext/object/helpers.rb in visionmedia-rext-0.2.1
- old
+ new
@@ -16,6 +16,26 @@
def indifferent_hash
Hash.new { |hash, key| hash[key.to_s] if key.is_a? Symbol }
end
+ ##
+ # Yield and return +value+.
+ #
+ # === Examples
+ #
+ # people = []
+ # people << 'tj'
+ # people << 'foo'
+ #
+ # returning [] do |people|
+ # people << 'tj'
+ # people << 'foo'
+ # end
+ #
+
+ def returning value, &block
+ yield value
+ value
+ end
+
end
\ No newline at end of file