Sha256: bb36f08022eef0c7f80751cee1ee7ee0274a74197a66b47b6e9a9593bd05f1ca

Contents?: true

Size: 791 Bytes

Versions: 2

Compression:

Stored size: 791 Bytes

Contents

include SaferRailsConsole::Colors

app_name = if SaferRailsConsole::RailsVersion.six_or_above?
             ::Rails.application.class.module_parent.to_s.underscore.dasherize
           else
             ::Rails.application.class.parent.to_s.underscore.dasherize
           end
env_name = SaferRailsConsole.environment_name
status = ::Rails.application.sandbox ? 'read-only' : 'writable'
color = SaferRailsConsole.prompt_color

prompt = "#{app_name}(#{env_name})(#{status}):%03n:%i"

IRB.conf[:PROMPT][:RAILS_ENV] = {
  PROMPT_I: color_text("#{prompt}> ", color),
  PROMPT_N: color_text("#{prompt}> ", color),
  PROMPT_S: color_text("#{prompt}%l ", color),
  PROMPT_C: color_text("#{prompt}* ", color),
  RETURN: color_text('=> ', color).concat("%s\n")
}

IRB.conf[:PROMPT_MODE] = :RAILS_ENV

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
safer_rails_console-0.4.1 lib/safer_rails_console/consoles/irb.rb
safer_rails_console-0.4.0 lib/safer_rails_console/consoles/irb.rb