Issue #6721 has been updated by alexeymuranov (Alexey Muranov).


Anonymous wrote:
> Why you can't simply do the following?
>  
>  def full_name_with_affiliation_and_position
>    a_ap = " (#{a_ap})" unless (a_ap = [affiliation, academic_position].compact.join ', ').empty?
>    "#{full_name}#{a_ap}"
>  
>  
>  end

I can, but i guess i want it to look more like declarative programming, than like imperative.
----------------------------------------
Feature #6721: Object#yield_self
https://bugs.ruby-lang.org/issues/6721#change-36088

Author: alexeymuranov (Alexey Muranov)
Status: Open
Priority: Normal
Assignee: 
Category: core
Target version: next minor


=begin
I think the following method is missing from Ruby:

 class Object
   def yield_self(*args)
     yield(self, *args)
   end
 end

I do not know a good use case, but it looks very natural to me.  It can be used in method chains.

What do you think?  Is there an alternative?
=end



-- 
http://bugs.ruby-lang.org/