Several files and libraries
Load your own files with require_relative, and what Ruby offers without installing gems.
Runs in Zerethon IDE · Ruby 4.0
Official Ruby documentation ↗
main.rb
require_relative "geometry"
puts Geometry.area(3, 4)
puts Math.sqrt(16)
geometry.rb
module Geometry
def self.area(width, height)
width * height
end
end
Output
12 4.0
main.rb (the entry, run by Run) and geometry.rb next to it.
require_relative "geometry"loadsgeometry.rbfrom the same folder as the current file;require_relative "lib/text"loadslib/text.rb.requireloads a library by name:json,csv,set,time,date,securerandomand the other default and bundled gems are available.gem installandbundle installare not available: runs have no network and nothing is installed during a run.