Module: Pry::Config::Attributable Private

Included in:
Pry::Config
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/config/attributable.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Attributable provides the ability to create “attribute” accessors. Attribute accessors create a standard “attr_writer” and a customised “attr_reader”. This reader is Proc-aware (lazy).

Since:

  • v0.13.0

Instance Method Summary collapse

Instance Method Details

#attribute(attr_name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • v0.13.0



12
13
14
15
16
17
18
19
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/config/attributable.rb', line 12

def attribute(attr_name)
  define_method(attr_name) do
    value = Config::Value.new(instance_variable_get("@#{attr_name}"))
    value.call
  end

  attr_writer(attr_name)
end