Skip to content

Instantly share code, notes, and snippets.

@alissonbrunosa
Created July 25, 2023 15:34
Show Gist options
  • Save alissonbrunosa/ad4dca683ab37569ec207993cb933245 to your computer and use it in GitHub Desktop.
Save alissonbrunosa/ad4dca683ab37569ec207993cb933245 to your computer and use it in GitHub Desktop.
class String
def red = "\e[31m#{self}\e[0m"
def cyan = "\e[36m#{self}\e[0m"
end
if defined? Rails
project_name = File.basename(Dir.pwd).cyan
envrionment = ENV['RAILS_ENV'].red
prompt = "(#{project_name}) -> [#{envrionment}]"
IRB.conf[:PROMPT] ||= {}
IRB.conf[:PROMPT][:RAILS] = {
:PROMPT_I => "#{prompt} %03n => ",
:PROMPT_S => "#{prompt} %03n => ",
:PROMPT_C => "#{prompt} %03n => ",
:RETURN => "=> %s\n",
}
IRB.conf[:PROMPT_MODE] = :RAILS
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment