mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
add Pry.configure as an alternative to the current way of changing configuration options.
Pry.configure do |config| config.eager_load! # optional config.input = # ... config.foo = 1 end
This commit is contained in:
parent
82ed5c7da8
commit
149d2827e8
3 changed files with 18 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
### HEAD
|
||||
* Add `Pry.configure` as an alternative to the current way of changing configuration options in `.pryrc` files.
|
||||
* Remove Slop as a runtime dependency by vendoring v3.4 as Pry::Slop.
|
||||
People can depend on Slop v4 and Pry at the same time without running into version conflicts. ([#1497](https://github.com/pry/pry/issues/1497))
|
||||
* Fix auto-indentation of code that uses a single-line rescue ([#1450](https://github.com/pry/pry/issues/1450))
|
||||
|
|
|
@ -32,6 +32,14 @@ class Pry
|
|||
def history
|
||||
@history ||= History.new
|
||||
end
|
||||
|
||||
#
|
||||
# @return [void]
|
||||
# Yields a block with {Pry.config} as its argument.
|
||||
#
|
||||
def configure
|
||||
yield config
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -5,6 +5,15 @@ describe Pry do
|
|||
@str_output = StringIO.new
|
||||
end
|
||||
|
||||
describe "Pry.configure" do
|
||||
it "yields a block with Pry.config as its argument" do
|
||||
Pry.configure do |config|
|
||||
config.foo = "bar"
|
||||
end
|
||||
expect(Pry.config.foo).to eq("bar")
|
||||
end
|
||||
end
|
||||
|
||||
describe "Exotic object support" do
|
||||
# regression test for exotic object support
|
||||
it "Should not error when return value is a BasicObject instance" do
|
||||
|
|
Loading…
Reference in a new issue