I am an active member of Ruby community. I have been consistently contributing to Ruby on Rails for a number of years and now am one of the top 30 contributors to Ruby on Rails. I also help as co-editor for the This week in Rails newsletter. Besides Ruby on Rails I have also contributed to many other notable open source projects including Sinatra, Devise and Rake. I am a seasoned speaker an have spoken at many conferences around the world including Gogaruco in San Francisco, RedDotRubyConf in Singapore, RubyConfIndia in Goa, India MadisonPlusRuby in Madison, Wisconsin, RubyConfBrazil in Suo Paulo, Brazil, and RubyConf Philippines in Manilla, Philippines. I am organizer of Deccan Ruby Conference and used to run RubyIndia Podcast. During my early days of open source as part of "Google summer of code" I contributed to the krypt-project project. Later I helped mentor in the JRuby and currently mentor in the Ruby on Rails organization for Google summer of code. When not working on Ruby, I am mostly working on Reactjs. I have authored the book Building Modern Web Applications with React.js which is published by PACKT. I have produced a number of screencasts on the topic of Learn React.js.
2 minute read
Rails 6 has made
many new additions to Array and Enumerable:
Array#including
Array#excluding
Enumerable#including
Enumerable#excluding
Array#excluding and Enumerable#excluding
There are times when we would like to remove an element from a collection.
On Array or Enumerable, we could achieve this by collectionA - collectionB.
Rails offers a more readable approach to these via Array#without and Enumerable#without
With the introduction of its counterparts #including,
we can now perform this same functionality as #excluding
With this addition, it also fixes an issue
where the exclusion would fail if we passed an Array.
We can also successfully pass collections to be excluded now.
The without method is still available and is an alias to excluding.
Array#including and Enumerable#including
To match their counterparts #excluding we can now
perform #including on Array and Enumerable.
This is a shorthand and more readable form of
addition of two collections.
As we can see, #including and #excluding add an easier and more readable way to
work with collection addition and removals.