mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
lazy load the config defaults for "history" and "gist"
This commit is contained in:
parent
c584d173a1
commit
469d48c7be
2 changed files with 14 additions and 20 deletions
|
@ -31,6 +31,7 @@
|
|||
* `Pry::CLI.parse_options` does not start Pry anymore ([#1393](https://github.com/pry/pry/pull/1393))
|
||||
* The gem uses CPU-less platforms for Windows now ([#1410](https://github.com/pry/pry/pull/1410))
|
||||
* Add `Pry::Config::Lazy` to make it easier to reimplement `Pry::Config::Default` without knowing its implementation [#1503](https://github.com/pry/pry/pull/1503/)
|
||||
* Lazy load the config defaults for `Pry.config.history` and `Pry.config.gist`.
|
||||
|
||||
### 0.10.1
|
||||
|
||||
|
|
|
@ -112,28 +112,11 @@ class Pry::Config::Default
|
|||
require "pry/input_completer"
|
||||
Pry::InputCompleter
|
||||
},
|
||||
exec_string: proc {
|
||||
""
|
||||
}
|
||||
})
|
||||
|
||||
def initialize
|
||||
super(nil)
|
||||
configure_gist
|
||||
configure_history
|
||||
end
|
||||
|
||||
private
|
||||
# TODO:
|
||||
# all of this configure_* stuff is a relic of old code.
|
||||
# we should try move this code to being command-local.
|
||||
def configure_gist
|
||||
self["gist"] = Pry::Config.from_hash(inspecter: proc(&:pretty_inspect))
|
||||
end
|
||||
|
||||
def configure_history
|
||||
self["history"] = Pry::Config.from_hash "should_save" => true,
|
||||
"should_load" => true
|
||||
gist: proc {
|
||||
Pry::Config.from_hash({inspecter: proc(&:pretty_inspect)}, nil)
|
||||
},
|
||||
history: proc {
|
||||
Pry::Config.from_hash({should_save: true, should_load: true}, nil).tap do |history|
|
||||
history.file = File.expand_path("~/.pry_history") rescue nil
|
||||
if history.file.nil?
|
||||
self.should_load_rc = false
|
||||
|
@ -141,7 +124,17 @@ class Pry::Config::Default
|
|||
history.should_load = false
|
||||
end
|
||||
end
|
||||
},
|
||||
exec_string: proc {
|
||||
""
|
||||
}
|
||||
})
|
||||
|
||||
def initialize
|
||||
super(nil)
|
||||
end
|
||||
|
||||
private
|
||||
def lazy_readline
|
||||
require 'readline'
|
||||
Readline
|
||||
|
|
Loading…
Reference in a new issue