Ruby at the Front Line of Disaster Prevention

Ruby at the Front Line of Disaster Prevention
Ruby at the Front Line of Disaster Prevention

December 26, 2025

How Tokyo Gas Uses Ruby to Protect Millions of People During Earthquakes

Based on the RubyWorld Conference 2025 presentation by Maika Yamaguchi, Tokyo Gas i-Net Corp.


When we think about Ruby in production, we usually imagine web platforms, SaaS products, or developer tools. But in Tokyo, Ruby is doing something far more critical: it is protecting millions of people from fires and explosions after major earthquakes.

At RubyWorld Conference 2025, Maika Yamaguchi from Tokyo Gas i-Net Corporation presented one of the most impressive real-world Ruby deployments ever shown: the earthquake disaster prevention system of the Tokyo Gas Group, a nationwide, mission-critical infrastructure that must work perfectly under the worst possible conditions.

This is the story of how Ruby became the backbone of a national safety system.


The Scale of the Problem

Tokyo Gas operates one of the largest urban gas networks in the world.

In the Tokyo metropolitan area alone, their infrastructure includes:

  • More than 4,000 district governors (gas pressure regulation stations)
  • More than 4,000 earthquake sensors
  • A pipeline network whose total length equals 1.5 times the circumference of the Earth
Article content

When a large earthquake hits, gas leaks can lead to massive fires and explosions. The response must be automatic, precise, and extremely fast.

Tokyo Gas therefore built a system called SUPREME — a fully automated earthquake response platform that controls gas supply across the entire city.

Advertise on RubyStackNews

RubyStackNews is a niche publication read by Ruby and Rails developers worldwide. Our audience includes senior engineers, tech leads, and decision-makers from the US, Europe, and Asia.

Sponsorship Options

📝 Article Sponsorship
Your brand featured inside a technical article (clearly marked as sponsored).
📌 Inline Sponsored Block
Highlighted sponsor section embedded within an article.
📎 Sidebar Sponsor
Logo + link displayed site-wide in the sidebar.
  • Highly targeted Ruby / Rails audience
  • Organic traffic from search and developer communities
  • No ad networks — direct sponsorships only

Interested in sponsoring RubyStackNews?

Contact via WhatsApp

What Happens When an Earthquake Hits?

The moment seismic activity is detected, SUPREME starts working.

  1. Sensors at 4,000 locations measure shaking (SI value and acceleration).
  2. Data is transmitted to Tokyo Gas’s central systems.
  3. SUPREME combines this data with:
  4. It estimates which areas are damaged.
  5. The network is divided into small blocks, and only the dangerous ones are shut down.
  6. Gas is remotely stopped in unsafe areas.
  7. In safe zones, gas supply continues.
  8. As inspections progress, safe blocks are remotely restarted without sending technicians on site.
Article content

All of this happens in about 10 minutes — an extraordinary achievement for a system controlling a city-scale energy network.


Public Transparency

The system does not only serve internal operations.

Tokyo Gas publishes the real-time gas status on a public platform called “Recovery My Map”. Citizens can see which areas have gas, which are shut down, and which are being restored.

The same data is also shared with:

  • NHK (Japan’s public broadcaster)
  • Government disaster response systems
  • Local municipalities

The system is also multilingual (Japanese, English, Korean, Chinese, Spanish), so even foreign residents can understand what is happening during a crisis.


Why Ruby?

This is where the story becomes truly fascinating.

When Tokyo Gas designed this system, their top priority was:

Quality. Absolute reliability.

Earthquake systems cannot be “mostly correct.” They must work every time, under extreme conditions, for scenarios that may never have happened before.

The team found that Ruby gave them a critical advantage.

Ruby enabled massive testing

They must simulate:

  • Thousands of sensors
  • Countless earthquake patterns
  • Different soil conditions
  • Pipeline damage
  • Partial failures

With Ruby and RSpec, engineers can easily write tests that represent complex real-world scenarios:

  • Different seismic values
  • Different pipeline states
  • Different network topologies

Because Ruby is expressive and fast to modify, they can continuously expand and refine their test coverage.

This allowed them to:

  • Run large-scale simulations
  • Detect logic errors early
  • Ensure disaster scenarios behave exactly as intended

In a safety-critical system, testing is the system.


Ruby in Long-Term Production

Tokyo Gas has been using Ruby in disaster systems for over 20 years:

Article content

This is not an experiment.

It is a mature, stable Ruby platform that has survived multiple major earthquakes.


Professional Ruby Engineering

Tokyo Gas also built a serious Ruby engineering ecosystem:

  • Common disaster logic is packaged as internal Ruby gems
  • Shared libraries for:
  • A private gem repository is used across all systems

This allows them to:

  • Keep consistency
  • Avoid duplicated logic
  • Roll out improvements safely

Ruby is treated as a long-term platform, not a scripting language.


High Availability with Ruby

SUPREME runs across:

  • A main data center
  • A backup data center
  • Automatic failover

Using Ruby’s standard libraries, they implemented:

  • Health checks
  • Communication monitoring
  • Automatic switching if a center goes down

Even if one data center fails during an earthquake, the system continues operating.


The Hard Parts

The team was also honest about Ruby’s weaknesses.

Generating map tiles and images on the server is difficult:

  • RMagick and MiniMagick were too slow
  • ruby-gd is used, but is poorly maintained

This shows a real challenge: Ruby’s ecosystem for high-performance image processing is still limited.


The Message to the Ruby Community

The final message of the presentation is powerful:

Ruby is not just productive — it is safe.

Tokyo Gas entrusted Ruby with:

  • Life-critical decisions
  • City-wide infrastructure
  • Disaster recovery

And it has delivered for more than two decades.

The more Ruby is used in serious, large-scale systems, the stronger the Ruby ecosystem becomes — which in turn enables even more ambitious systems.

Ruby is not just for startups. It is protecting Tokyo.


Article content

Leave a comment