Menu
CoddyTech

Run Ruby Files

Lesson 1 of 48 in Coddy's Ruby for Java Developers course.

Ruby is a dynamic, object-oriented language. Run the supplied program, then trace how main.rb loads exercise.rb with require_relative. Each later task keeps editable files first and a visible locked entry file last. No gems or previous Ruby experience are needed.

challenge icon

Challenge

Easy

Run the supplied program. It reads one line and returns a welcome message. Notice how the locked entry file loads the editable helper.

Return text from solve(input) without printing. The locked driver prints the returned text with one final newline and checks required public APIs independently.

Your code goes in exercise.rb. main.rb holds the supplied input/output code and cannot be edited.

Try it yourself

require_relative 'exercise'
def check(value)
  raise 'Public API check failed' unless value
end

puts solve(STDIN.read)

All lessons in Ruby for Java Developers

Practice on your own: Online Ruby compiler