<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Tessy Joseph on Medium]]></title>
        <description><![CDATA[Stories by Tessy Joseph on Medium]]></description>
        <link>https://medium.com/@tessyjoseph?source=rss-a722dc844bf5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*vMaEG4IG6HIGoxXn.</url>
            <title>Stories by Tessy Joseph on Medium</title>
            <link>https://medium.com/@tessyjoseph?source=rss-a722dc844bf5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 09:35:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tessyjoseph/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Ruby-2.7 adds Enumerable#filter_map]]></title>
            <link>https://medium.com/the-mavenhive-blog/ruby-2-7-adds-enumerable-filter-map-d84aad03b6d4?source=rss-a722dc844bf5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d84aad03b6d4</guid>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Tessy Joseph]]></dc:creator>
            <pubDate>Mon, 10 Jun 2019 14:44:39 GMT</pubDate>
            <atom:updated>2019-06-24T08:08:34.091Z</atom:updated>
            <content:encoded><![CDATA[<h3>Exploring Ruby-2.7.0 — Part-Three</h3><p>ruby-2.7 adds filter_map which combines filter and map in one iteration.</p><p>Let us suppose you have a collection of employee records. Assume you have to get the employee_id’s of all contract employees. This could be achieved using filter_map</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/88e25380488e60068e55ebc228bac343/href">https://medium.com/media/88e25380488e60068e55ebc228bac343/href</a></iframe><p><strong>Before ruby.27.0</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5c9f281817bf620588bddcd380a8b95e/href">https://medium.com/media/5c9f281817bf620588bddcd380a8b95e/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a4c876c54cd040a3959bd7de6966d3c/href">https://medium.com/media/6a4c876c54cd040a3959bd7de6966d3c/href</a></iframe><p><strong>Why you must use filter_map?</strong></p><ol><li>There would be a significant speedup as filter_map performs the operation in a single iteration</li><li>By using<em> filter_map </em>your code looks more elegant to read</li><li>filter_map could come very handy when manipulating Active Record object collections</li></ol><p>I am adding more examples from the <a href="https://github.com/ruby/ruby/pull/2017/files#diff-ee2df8926ba9a4b2eb7579142ba6b9a0">test cases</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0559be2755bcd4728158b4ab40e30e92/href">https://medium.com/media/0559be2755bcd4728158b4ab40e30e92/href</a></iframe><p>The only caveat is it would be impossible to intentionally return nil.</p><p>if you are interested how filter_map is implemented check this <a href="https://github.com/ruby/ruby/pull/2017/files">github link</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d84aad03b6d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-mavenhive-blog/ruby-2-7-adds-enumerable-filter-map-d84aad03b6d4">Ruby-2.7 adds Enumerable#filter_map</a> was originally published in <a href="https://medium.com/the-mavenhive-blog">The MavenHive Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ruby-2.7.0 Adds new method Enumerable#tally]]></title>
            <link>https://medium.com/the-mavenhive-blog/ruby-2-7-0-adds-new-method-enumerable-tally-30347ec32c51?source=rss-a722dc844bf5------2</link>
            <guid isPermaLink="false">https://medium.com/p/30347ec32c51</guid>
            <category><![CDATA[enumerable]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Tessy Joseph]]></dc:creator>
            <pubDate>Thu, 06 Jun 2019 07:17:06 GMT</pubDate>
            <atom:updated>2019-06-24T08:08:05.119Z</atom:updated>
            <content:encoded><![CDATA[<h3>Exploring Ruby-2.7.0 — Part-Two</h3><p>ruby-2.7 has introduced ‘<em>tally’</em> which returns a hash where the keys are elements and values are the count of occurrence</p><p>If you have been programming for a while you might have across a use case where you might have to store the count of elements in array .</p><p>Suppose we have an array of outcomes of dice roll and I want to count the distinct occurrence of all possibilities. In ruby-2.7 I could do this</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b9cd42fd36165c85f55d94a5dd1b56f6/href">https://medium.com/media/b9cd42fd36165c85f55d94a5dd1b56f6/href</a></iframe><p>Let us explore some of the implementations in previous versions of ruby.</p><ol><li>Using transform</li></ol><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ab93841457a2fc47e4df941ff0177fc/href">https://medium.com/media/9ab93841457a2fc47e4df941ff0177fc/href</a></iframe><p>2. Another variant</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/583df94e4957fdeb3ab467a72628bb7d/href">https://medium.com/media/583df94e4957fdeb3ab467a72628bb7d/href</a></iframe><p>3. Using inject</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65a3ce8582fb9fbc74e37eb2f293adbf/href">https://medium.com/media/65a3ce8582fb9fbc74e37eb2f293adbf/href</a></iframe><p>Naturally, among all the variant, the use of “tally” makes it more intuitive and the code more readable.</p><p>There are discussions in the community to add a new method ‘<em>tally_by</em>’ which would accept a block . Follow the discussions <a href="https://bugs.ruby-lang.org/issues/11076">here</a> about the new feature.</p><pre>[1, 2, 3].tally_by(&amp;:even?)</pre><p>Using tally this could be achieved using</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0b50619c05c7d039669a5010eeaedc29/href">https://medium.com/media/0b50619c05c7d039669a5010eeaedc29/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30347ec32c51" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-mavenhive-blog/ruby-2-7-0-adds-new-method-enumerable-tally-30347ec32c51">Ruby-2.7.0 Adds new method Enumerable#tally</a> was originally published in <a href="https://medium.com/the-mavenhive-blog">The MavenHive Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing ruby-2.7.0-preview1 using rbenv]]></title>
            <link>https://medium.com/the-mavenhive-blog/installing-ruby-2-7-0-preview1-using-rbenv-cab6f6a27757?source=rss-a722dc844bf5------2</link>
            <guid isPermaLink="false">https://medium.com/p/cab6f6a27757</guid>
            <category><![CDATA[rbenv]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[installation]]></category>
            <dc:creator><![CDATA[Tessy Joseph]]></dc:creator>
            <pubDate>Wed, 05 Jun 2019 15:12:31 GMT</pubDate>
            <atom:updated>2019-06-24T08:07:21.293Z</atom:updated>
            <content:encoded><![CDATA[<h3>Exploring Ruby-2.7.0 — Part-One</h3><p>Ruby 2.7.0-preview1 has been released on 30 May 2019. This blog explains how to setup ruby-2.7.0 on your system using <em>rbenv</em>.</p><p><strong>Prerequisite</strong></p><ol><li><em>rbenv</em> is a command line tool that lets you switch between multiple versions of ruby. To set up rbenv follow the instructions on this <a href="https://github.com/rbenv/rbenv#installation">link</a></li><li><em>ruby-build</em> is a command-line tool that makes it easy to install multiple ruby versions. Follow <a href="https://github.com/rbenv/ruby-build#readme">this</a> guide to install ruby-build as a rbenv plugin.</li></ol><p>If you already have rbenv and ruby-build installed , upgrade to your ruby-build to get the latest version</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/371d8820720ec34f57f7fa5d5168bbff/href">https://medium.com/media/371d8820720ec34f57f7fa5d5168bbff/href</a></iframe><p>Install ruby-2.7.0-preview1 and switch to 2.7.0-preview</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/23bd68b894f9b46c5e296c051d4159d4/href">https://medium.com/media/23bd68b894f9b46c5e296c051d4159d4/href</a></iframe><p>And now you are ready to code in <em>ruby-2.7.0-preview1</em>. Happy coding</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cab6f6a27757" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-mavenhive-blog/installing-ruby-2-7-0-preview1-using-rbenv-cab6f6a27757">Installing ruby-2.7.0-preview1 using rbenv</a> was originally published in <a href="https://medium.com/the-mavenhive-blog">The MavenHive Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>