<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Ruby on @zhisme :: signal over noise</title><link>https://zhisme.com/tags/ruby/</link><description>Recent content in Ruby on @zhisme :: signal over noise</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Wed, 10 Jun 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://zhisme.com/tags/ruby/index.xml" rel="self" type="application/rss+xml"/><item><title>The Constant Frozen at Boot Bug: A Ruby Exercise For An Interview</title><link>https://zhisme.com/articles/ruby-constant-frozen-at-boot/</link><pubDate>Wed, 10 Jun 2026 00:00:00 +0000</pubDate><guid>https://zhisme.com/articles/ruby-constant-frozen-at-boot/</guid><description>&lt;p>I like interview questions that come from real incidents instead of a puzzle book. You can&amp;rsquo;t google your way out of them, and the candidate&amp;rsquo;s reasoning maps directly onto the job. This one came from a payment service. It looks trivial. It is not.&lt;/p>
&lt;p>I&amp;rsquo;ve stripped the production code and rebuilt the same shape around a fake payment router. The bug is identical; the names are not.&lt;/p>
&lt;h2 id="the-question">The Question&lt;/h2>
&lt;blockquote>
&lt;p>Here is a class that routes payments to a gateway. Occasionally a charge is&lt;br>
written to the database with &lt;code>method_id = NULL&lt;/code>, even though the payment method&lt;br>
clearly exists in the &lt;code>payment_methods&lt;/code> table. No exception is raised. The only&lt;br>
thing that reliably fixes it is restarting the process. Find the bug.&lt;/p></description></item><item><title>Ruby IO buffering</title><link>https://zhisme.com/articles/ruby-io-buffering/</link><pubDate>Fri, 16 Jan 2026 00:00:00 +0000</pubDate><guid>https://zhisme.com/articles/ruby-io-buffering/</guid><description>&lt;p>Your Kibana/Cloudwatch/Grafana have different timestamps, you don&amp;rsquo;t see recent logs from your application. Why is that? You may ask. Some QA reports that your application is not working/was not deployed, asking you to review the deploy process. Or even worse: asking your devops colleagues to &amp;ldquo;something went wrong&amp;rdquo; with last deployment could you check?&lt;/p>
&lt;p>You login into your shell running &lt;code>kubectl get pods&lt;/code> to verify timestamps update or checking Helm releases &lt;code>helm ls&lt;/code>. But everything seems fine, everything deployed. CI/CD is green, all timestamps updated. But yet. QA does not see the logs. Where have they gone?&lt;/p></description></item><item><title>You Don’t Need Types in Ruby</title><link>https://zhisme.com/articles/you-dont-need-types-in-ruby/</link><pubDate>Wed, 29 Oct 2025 00:00:00 +0000</pubDate><guid>https://zhisme.com/articles/you-dont-need-types-in-ruby/</guid><description>&lt;p>There was a lively discussion on Hacker News &lt;a href="https://news.ycombinator.com/item?id=43938400">here&lt;/a> about &lt;a href="https://sorbet.org/">Sorbet&lt;/a> and static typing in Ruby that inspired this post.&lt;/p>
&lt;p>It’s fascinating how people try to make Ruby &lt;em>look&lt;/em> like a statically typed language. But this isn’t the first attempt — and every time, it ends up fighting against what Ruby fundamentally is.&lt;/p>
&lt;p>Turning Ruby into Java isn’t progress. It’s a step backward.&lt;br>
Let me explain why.&lt;/p>
&lt;h2 id="how-ruby-deals-with-types">How Ruby Deals with Types&lt;/h2>
&lt;p>Ruby is a dynamically typed, object-oriented language designed around message passing — an idea borrowed from &lt;a href="https://en.wikipedia.org/wiki/Smalltalk">Smalltalk&lt;/a>.&lt;/p></description></item><item><title>lazy_names gem, how much time do you spend in console?</title><link>https://zhisme.com/articles/lazy-names/</link><pubDate>Sun, 12 Jan 2020 00:00:00 +0000</pubDate><guid>https://zhisme.com/articles/lazy-names/</guid><description>&lt;p>I&amp;rsquo;m happy to share the &lt;a href="https://github.com/zhisme/lazy_names?tab=readme-ov-file#lazy_names">lazy_names&lt;/a> gem!&lt;br>
This gem allows you to define a config file that maps long, namespaced constants to something simpler and more intuitive:&lt;/p>
&lt;pre>&lt;code class="language-yml">'Models::Users::CreditCard': 'UserCard'
&lt;/code>&lt;/pre>
&lt;p>I spend a lot of time in the console, which is why I originally wrote this gem. Here’s a quick look at my most frequently run commands from my Zsh history:&lt;/p>
&lt;pre>&lt;code class="language-sh">$: history | awk '{$1=&amp;quot;&amp;quot;; print $0}' | sort | uniq -c | sort -nr
 647 gs
 135 rc # rails console
 135 ls
 134 gd
 ...
&lt;/code>&lt;/pre>
&lt;p>Do you use the Ruby console much while developing? I personally like to check my code directly in the console — calling methods to inspect return values — especially in the early development stage before tests are written. Sometimes, I need to drop records from the database or build some structs on the fly.&lt;/p></description></item></channel></rss>