<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Evgeny Zhdanov</title>
    <description>The latest articles on DEV Community by Evgeny Zhdanov (@zhisme).</description>
    <link>https://dev.to/zhisme</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F536856%2F4f501d62-c0f5-46aa-836f-d6b5d1d51aba.png</url>
      <title>DEV Community: Evgeny Zhdanov</title>
      <link>https://dev.to/zhisme</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zhisme"/>
    <language>en</language>
    <item>
      <title>lazy_names gem, lets you type less</title>
      <dc:creator>Evgeny Zhdanov</dc:creator>
      <pubDate>Thu, 22 Feb 2024 18:13:44 +0000</pubDate>
      <link>https://dev.to/zhisme/lazynames-gem-lets-you-type-less-4l54</link>
      <guid>https://dev.to/zhisme/lazynames-gem-lets-you-type-less-4l54</guid>
      <description>&lt;p&gt;Greetings!&lt;/p&gt;

&lt;p&gt;It's been a while since I last had the opportunity to release a new version of the gem, designed to streamline your console operations and minimize typing.&lt;/p&gt;

&lt;p&gt;The core concept remains unchanged: you specify lengthy constant names and assign shorter, more convenient aliases that suit your needs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;my_awesome_project&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;definitions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Models::Users::CreditCard'&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;MUCC'&lt;/span&gt;
&lt;span class="na"&gt;my_another_project&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;definitions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;OtherLongConst'&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Short'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As per the configuration, you can now use &lt;code&gt;MUCC&lt;/code&gt; within your console environment.&lt;/p&gt;

&lt;p&gt;However, in this latest version, I've opted to simplify the configuration on a per-project basis, eliminating the need to explicitly define namespaces. After all, if the gem can resolve it automatically, why burden the user with additional work, huh?&lt;/p&gt;

&lt;p&gt;For detailed information on the new logic, please refer to the GitHub readme section &lt;a href="https://github.com/zhisme/lazy_names?tab=readme-ov-file#project-definitions"&gt;here&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;definitions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Models::Users::CreditCard:&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;'MUCC'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes &lt;code&gt;MUCC&lt;/code&gt; readily available. Additionally, I've refined the error handling logic to provide more precise and targeted feedback, aiding in troubleshooting if the configuration evaluation fails.&lt;/p&gt;

&lt;p&gt;The gem is accessible on both &lt;a href="https://rubygems.org/gems/lazy_names"&gt;RubyGems&lt;/a&gt; and &lt;a href="https://github.com/zhisme/lazy_names"&gt;GitHub&lt;/a&gt;. Feel free to contribute, engage in discussions, report issues, or simply give it a try – you might just find the tool you've been seeking!&lt;/p&gt;

&lt;p&gt;The earlier article discussing the development rationale behind the Lazy Names gem can be found &lt;a href="https://dev.to/zhisme/lazynames-gem-ease-console-operations-2pg4"&gt;here.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>opensource</category>
      <category>gem</category>
    </item>
    <item>
      <title>lazy_names gem, ease console operations</title>
      <dc:creator>Evgeny Zhdanov</dc:creator>
      <pubDate>Thu, 10 Dec 2020 08:30:04 +0000</pubDate>
      <link>https://dev.to/zhisme/lazynames-gem-ease-console-operations-2pg4</link>
      <guid>https://dev.to/zhisme/lazynames-gem-ease-console-operations-2pg4</guid>
      <description>&lt;p&gt;Hello guys!&lt;/p&gt;

&lt;p&gt;I just wrote a gem which can help with console routine.&lt;/p&gt;

&lt;p&gt;A little bit of history, I caught myself mostly redefining constants to shorter versions but by hand, because I needed from time to time models, or some services, or operations and all of them were hidden by some modules (and that's ok you must put your code in namespace modules).&lt;br&gt;&lt;br&gt;
But I was asking myself do I really needed to type something like &lt;code&gt;App::SomeEntity::Services::ServiceNamespace::ServiceAction.new.perform&lt;/code&gt; or even bigger.&lt;br&gt;&lt;br&gt;
Before I was just assigning it to shorter version on my &lt;code&gt;pry&lt;/code&gt; console load, but that again led to same actions every &lt;code&gt;pry&lt;/code&gt; console load. So I decided to wrap it in gem. So you have configuration where you put your map real constant =&amp;gt; easy/lazy name.  &lt;/p&gt;

&lt;p&gt;So I looking for some feedback/critique. Maybe it was already implemented by someone and you could point me. I was using it only localhost for some period of time and finally decided to put in &lt;a href="https://github.com/zhisme/lazy_names"&gt;github&lt;/a&gt; and &lt;a href="https://rubygems.org/gems/lazy_names"&gt;rubygems&lt;/a&gt;, maybe some of you were struggling same issues in your ruby console&lt;/p&gt;

&lt;p&gt;Also I inspired by some ideas given to me by other devs, like auto-redefining const on some reducer, so for example&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;# the default one&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;shortener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;klass_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="n"&gt;klass_name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_s&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gsub&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'::'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;''&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sr"&gt;/[a-z]/&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;select&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;empty?&lt;/span&gt; &lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="n"&gt;shortener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;MyClass&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# =&amp;gt; MC&lt;/span&gt;
&lt;span class="n"&gt;shortener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;MyModule&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MyClass&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# =&amp;gt; MMMC&lt;/span&gt;
&lt;span class="n"&gt;shortener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;MyModule&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;MyModelsNamespace&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="c1"&gt;# =&amp;gt; MMNM&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The main usage for the gem I see as &lt;strong&gt;Hexagonal Architecture&lt;/strong&gt;, where you code highly decoupled by the modules. &lt;/p&gt;

&lt;p&gt;What do you think about the gem, share thoughts with me! :)&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
