module ObjectAs
Constants
- VERSION
Public Instance Methods
as{|x|...} → obj
click to toggle source
Yields self to the block, and then returns the return value of the block. The primary purpose of this method is to transform a value in a method chain without breaking the chain.
- 1, 2, 3
-
.map {|x| x * x } .as {|array| array.reverse } .each {|x| puts x }
# File lib/object_as.rb, line 16 def as yield self end