<?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 edmundo sanchez on Medium]]></title>
        <description><![CDATA[Stories by edmundo sanchez on Medium]]></description>
        <link>https://medium.com/@mundo03?source=rss-b65538b6e352------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Z-Qz-oYZEC3yuj1fmhM3yA.png</url>
            <title>Stories by edmundo sanchez on Medium</title>
            <link>https://medium.com/@mundo03?source=rss-b65538b6e352------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 00:48:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mundo03/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, config this]]></title>
            <link>https://mundo03.medium.com/ruby-config-this-e3d6c4e1482b?source=rss-b65538b6e352------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3d6c4e1482b</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[config]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[rubygems]]></category>
            <dc:creator><![CDATA[edmundo sanchez]]></dc:creator>
            <pubDate>Fri, 05 Mar 2021 22:09:34 GMT</pubDate>
            <atom:updated>2021-03-06T04:37:42.901Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MdLInka79NYcoJYM" /><figcaption>Photo by <a href="https://unsplash.com/@joeel56?utm_source=medium&amp;utm_medium=referral">Nicole Wolf</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever wondered where is the right way to store sensitive information like passwords for your ruby scripts and gems?</p><p>I have, doing some research I found a few ways to do that, like the <a href="https://medium.com/@vfreefly/the-most-simple-configuration-block-implementation-for-a-ruby-gem-815fe1dad5dc">Simplest configuration block implementation for a ruby gem ever</a> or <a href="http://lizabinante.com/blog/creating-a-configurable-ruby-gem/">Creating a configurable Ruby gem</a></p><p>I also found using a file is the best way to store sensitive information but there are use cases to have Environmental variables or just hard-coding values.</p><p>However following that for every script I write is a bit cumbersome for me, I like easy things and automation so as a learning exercise I created a gem called <a href="https://rubygems.org/gems/config_this">config_this</a>.</p><p>With <strong>Config_this</strong> you can load your configuration parameters from a YAML or JSON file, a block, a hash or Environment Variables.</p><p>Add this line to your application’s Gemfile:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b8d5e35bc1756c36fe55c217812a25e/href">https://medium.com/media/9b8d5e35bc1756c36fe55c217812a25e/href</a></iframe><p>And then execute:</p><p>$ bundle install</p><p>Or install it yourself as:</p><p>$ gem install config_this</p><p>The Config Module is the main interface for this gem, as you know you can not instantiate a Module so be careful with your values</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74d783ae70fc7e8fa3d2b72d19db160c/href">https://medium.com/media/74d783ae70fc7e8fa3d2b72d19db160c/href</a></iframe><p>This will get the latest object you created.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/478cccf21c0d139e06fa2bbb8ac60ced/href">https://medium.com/media/478cccf21c0d139e06fa2bbb8ac60ced/href</a></iframe><p>If you plan on having only one configuration object you don’t need to assign it, it will always return what you set.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/95d292b6386c83c2f03faf820aeb908e/href">https://medium.com/media/95d292b6386c83c2f03faf820aeb908e/href</a></iframe><p>If you do plan to have multiple configurations, handle them properly</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/078d20f66bc6253effd9614afbf13a8d/href">https://medium.com/media/078d20f66bc6253effd9614afbf13a8d/href</a></iframe><h4>Setting it With a Hash</h4><p>As you noticed, this is how you set it with a hash:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5259b04566531e5619484406a428afd3/href">https://medium.com/media/5259b04566531e5619484406a428afd3/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f74e4f5b22275832305503965b582f5/href">https://medium.com/media/2f74e4f5b22275832305503965b582f5/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d26b68919af4c68898cfe50ae417ae51/href">https://medium.com/media/d26b68919af4c68898cfe50ae417ae51/href</a></iframe><p>Be sure the variables are set and accessible</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c016dcfd804af593377080ca29bff9a4/href">https://medium.com/media/c016dcfd804af593377080ca29bff9a4/href</a></iframe><p>To do this, you have to use the Config::Configuration class directly</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/043d922de338f31e8f2f9d07c8872b20/href">https://medium.com/media/043d922de338f31e8f2f9d07c8872b20/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4bde32e85beb1d0049eb9f5b02eb1bda/href">https://medium.com/media/4bde32e85beb1d0049eb9f5b02eb1bda/href</a></iframe><p>You can also just set new values to the Configuration object</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d150d05e5a050802cac195989c90bef5/href">https://medium.com/media/d150d05e5a050802cac195989c90bef5/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3d6c4e1482b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>