
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

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
Your brand featured inside a technical article (clearly marked as sponsored).
Highlighted sponsor section embedded within an article.
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 WhatsAppWhat Happens When an Earthquake Hits?
The moment seismic activity is detected, SUPREME starts working.
- Sensors at 4,000 locations measure shaking (SI value and acceleration).
- Data is transmitted to Tokyo Gas’s central systems.
- SUPREME combines this data with:
- It estimates which areas are damaged.
- The network is divided into small blocks, and only the dangerous ones are shut down.
- Gas is remotely stopped in unsafe areas.
- In safe zones, gas supply continues.
- As inspections progress, safe blocks are remotely restarted without sending technicians on site.

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:

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.
