Ruby Quick Reference

Quick reference for efficient coding

View the Project on GitHub YumaYX/RubyQuickReference

file.rb(path)

__FILE__ in Ruby is a predefined constant that represents the current file’s name. It returns a string with the name of the file in which it is used.

Execution:

__FILE__
#=> "file.rb(irb)"

Executed with Ruby 3.3.5