OOZOU
Get in Touch
Back to TIL
ruby

Automagical Intermediate-level Hashtables in Ruby

October 13, 2020

All intermediate-level hashtables will be created automagically

def autovivifying_hash
   Hash.new {|ht,k| ht[k] = autovivifying_hash}
end

Usage

response_builder = autovivifying_hash
response_builder['payment']['status'] = 'OK'
response_builder # => {"payment"=>{"status"=>"OK"}

More on ruby

rubyApril 30, 2021

Allow pasting multiline ruby blocks in Pry when using leading dot notation

We use leading dot notation a lot now e.g.

rubyOctober 14, 2020

Heredoc without interpolation

Sometimes you want to use Ruby's Heredoc without interpolation ('#{....}'). You can do this by adding single dashes around your keyword:

rubyOctober 13, 2020

Change Ruby version for single command with rbenv

You can switch Ruby version temporarily with rbenv local

Have a project in mind?

We'd love to hear what you're building.

Start a Conversationhello@oozou.com
OOZOU Logo

Bangkok · Singapore · Hong Kong

X
Facebook
Instagram
LinkedIn

Services

  • Web Development
  • AI Agents & Generative AI
  • Mobile App Development
  • Data Analytics & Engineering
  • UI/UX & Product Design
  • Digital Transformation

Company

  • About Us
  • Careers
  • Blog
  • Whitepapers
  • Case Studies
  • Today I Learned
  • Contact

More

  • Industries
  • Get an Estimate
  • Partner Network
© 2026 OOZOU. All rights reserved.
Privacy PolicyCode of ConductABAC Policy