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
Kyrylo Silin 4b6fc303bb config: simplify structure
* Replace `require_relative` with `require`
  The project tries to use the `require` form everywhere where possible, which
  is the common form
* `require` from `pry.rb`
  Spreaded `require` statements where we require internal classes is confusing
* Fixed namespace definition for Config classes
  https://github.com/rubocop-hq/ruby-style-guide#namespace-definition recommends
  to use explicit nesting
2018-10-28 17:45:29 +08:00

28 lines
604 B
Ruby

class Pry
class Config < Pry::BasicObject
module Convenience
SHORTCUTS = [
:input,
:output,
:commands,
:print,
:exception_handler,
: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
end
end