Ruby IRB config
Last update
2024-07-18
2024-07-18
« — »
~/.irbrc
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-history" IRB.conf[:SAVE_HISTORY] = 10000 if defined?(Rails) car_file = Rails.root.join('.console-autorun.rb').to_s if File.exist?(car_file) puts "Loading .console-autorun.rb" unless $LOADED_FEATURES.include?(car_file) require car_file # https://guides.rubyonrails.org/v6.1.0/autoloading_and_reloading_constants.html#autoloading-when-the-application-boots Rails.application.reloader.to_prepare{ load car_file } else app_name = Rails.application.class.module_parent_name rescue '--' case app_name when 'Xxx' ... when 'Yyyy' ... when defined?(Zzz) ... end end end # https://github.com/amazing-print/amazing_print if defined? AmazingPrint AmazingPrint.defaults = { indent: 2, sort_keys: true } AmazingPrint.irb! end |