1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/lib/pry/config/convenience.rb
Robert Gleeson 325016eb3a fix the failing Pry#prompt specs.
this is a strange and odd case. Pry.prompt is a delegate to Pry.config, as
it has always been. the same delegate was setup on an instance of Pry, but
never used because we define #prompt and #prompt= with our implementation.

the thing that would make the most sense (to me) is to not support Pry.prompt
anymore and recommend the use of Pry.config.prompt instead. a lot of code relies
on Pry.prompt though, so we have to support the delegate to config and implement
custom behavior for the pry instance.
2014-01-21 09:13:26 +01:00

26 lines
629 B
Ruby

module Pry::Config::Convenience
SHORTCUTS = [
:input,
:output,
:commands,
:print,
:exception_handler,
:quiet?,
:hooks,
:color,
:pager,
:editor,
:memory_size,
:extra_sticky_locals
]
def config_shortcut(*names)
names.each do |name|
reader = name
setter = "#{name}="
define_method(reader) { config.public_send(name) }
define_method(setter) { |value| config.public_send(setter, value) }
end
end
end