Module: Ripl::Irb::ConvertIrb

Defined in:
lib/ripl/irb.rb

Constant Summary collapse

CONFIG_MAP =
{
  :PROMPT_MODE => :prompt, :PROMPT => :prompt, :HISTORY_FILE => :history,
  :USE_READLINE => :readline, :AP_NAME => :name, :RC => :irbrc
}
DESC_MAP =
{
  :SINGLE_IRB => "jump commands in ripl-commands plugin have this enabled by default",
  :IRB_RC => "Use ripl-after_rc plugin instead of IRB.conf[:IRB_RC]",
  :AUTO_INDENT => 'Use ripl-auto_indent plugin instead of IRB.conf[:AUTO_INDENT]',
  :SCRIPT => 'Use ripl-play plugin instead of IRB.conf[:SCRIPT]',
  :RC_NAME_GENERATOR => "Use Ripl.config[:history] or Ripl.config[:irbrc] "+
    "instead of IRB.conf[:RC_NAME_GENERATOR]",
  :MAIN_CONTEXT => 'Use Ripl.shell instead of IRB.conf[:MAIN_CONTEXT]',
  :LOAD_MODULES => 'No need to use IRB.conf[:LOAD_MODULES]. Just use require :)',
  :SAVE_HISTORY => 'See https://github.com/cldwalker/ripl-misc/blob/master/lib/ripl/history_size.rb for IRB.conf[:SAVE_HISTORY]',
  :MATH_MODE => 'See https://github.com/cldwalker/ripl-misc/blob/master/lib/ripl/math.rb for IRB.conf[:MATH_MODE]',
  :ECHO => 'See https://github.com/cldwalker/ripl-misc/blob/master/lib/ripl/echo.rb for IRB.conf[:ECHO]',
  :INSPECT_MODE => 'See https://github.com/cldwalker/ripl-misc/blob/master/lib/ripl/inspect.rb for IRB.conf[:INSPECT_MODE]',
  :BACK_TRACE_LIMIT => 'See https://github.com/cldwalker/ripl-misc/blob/master/lib/ripl/backtrace_limit.rb for IRB.conf[:BACK_TRACE_LIMIT]',
  :IGNORE_SIGINT => 'See https://github.com/cldwalker/ripl-misc/blob/master/lib/ripl/ignore_sigint.rb for IRB.conf[:IGNORE_SIGINT]'
}
RETURN_MAP =
{
  :LOAD_MODULES => [], :IRB_RC => lambda { }, :RC_NAME_GENERATOR => lambda { },
  :SAVE_HISTORY => 500, :PROMPT => {}, :HISTORY_FILE => ''
}

Instance Method Summary collapse

Instance Method Details

#[](key) ⇒ Object



51
52
53
54
55
56
57
58
59
# File 'lib/ripl/irb.rb', line 51

def [](key)
  return RETURN_MAP[key] unless Ripl.config[:irb_verbose]
  if ripl_key = CONFIG_MAP[key]
    puts "Use Ripl.config[#{ripl_key.inspect}] instead of IRB.conf[#{key.inspect}]"
  elsif desc = DESC_MAP[key]
    puts desc
  end
  RETURN_MAP[key]
end

#[]=(key, val) ⇒ Object



46
47
48
49
# File 'lib/ripl/irb.rb', line 46

def []=(key, val)
  self[key]
  val
end