Class: Pry::Config::Default

Inherits:
Object show all
Includes:
Behavior
Defined in:
lib/pry/config/default.rb

Constant Summary

Constants included from Behavior

Behavior::ASSIGNMENT, Behavior::INSPECT_REGEXP, Behavior::NODUP

Instance Method Summary collapse

Methods included from Behavior

#==, #[], #[]=, #__clip_inspect, #__dup, #__push, #__remove, #__try_convert_to_hash, #clear, #default, #forget, included, #inspect, #key?, #keys, #merge!, #method_missing, #pretty_print, #respond_to_missing?, #to_hash

Constructor Details

#initializeDefault

Returns a new instance of Default



116
117
118
119
120
# File 'lib/pry/config/default.rb', line 116

def initialize
  super(nil)
  configure_gist
  configure_history
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Pry::Config::Behavior

Instance Method Details

#configure_gistObject (private)

TODO: all of this configure_* stuff is a relic of old code. we should try move this code to being command-local.



135
136
137
# File 'lib/pry/config/default.rb', line 135

def configure_gist
  self["gist"] = Pry::Config.from_hash(inspecter: proc(&:pretty_inspect))
end

#configure_historyObject (private)



139
140
141
142
143
144
145
146
147
148
# File 'lib/pry/config/default.rb', line 139

def configure_history
  self["history"] = Pry::Config.from_hash "should_save" => true,
    "should_load" => true
  history.file = File.expand_path("~/.pry_history") rescue nil
  if history.file.nil?
    self.should_load_rc = false
    history.should_save = false
    history.should_load = false
  end
end

#lazy_readlineObject (private)



150
151
152
153
154
155
156
157
158
159
160
# File 'lib/pry/config/default.rb', line 150

def lazy_readline
  require 'readline'
  Readline
rescue LoadError
  warn "Sorry, you can't use Pry without Readline or a compatible library."
  warn "Possible solutions:"
  warn " * Rebuild Ruby with Readline support using `--with-readline`"
  warn " * Use the rb-readline gem, which is a pure-Ruby port of Readline"
  warn " * Use the pry-coolline gem, a pure-ruby alternative to Readline"
  raise
end