Then_tap
class Apa
attr_accessor :donkey
def initialize = ( @donkey = :Eyore )
def to_string = ( @donkey.to_s )
end
rev = ->(str) { str.reverse }
# `tap` is yielding Apa.new
apa = Apa.new.tap {|ap| ap.donkey = :Roi }
p apa.donkey # => :Roi
# `then` is same as `yield_self`
# and is yielding the block
p apa.tap { p it.class } # => Apa
.then(&:to_string).tap { p it.class } # => String
.then(&rev)
.upcase # => "IOR"
Code is just an example of class-method; proc (lambda) and the use of tap
and then
.