Class: Utils::IRB::Shell::ConstantWrapper
- Inherits:
-
WrapperBase
- Object
- WrapperBase
- Utils::IRB::Shell::ConstantWrapper
- Defined in:
- lib/utils/irb.rb
Overview
A wrapper class for Ruby constant objects that provides enhanced introspection and display capabilities.
This class extends WrapperBase to create specialized wrappers for Ruby constant objects, offering detailed information about constants including their names and associated classes. It facilitates interactive exploration of Ruby constants in environments like IRB by providing structured access to constant metadata and enabling sorting and comparison operations based on constant descriptions.
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
The klass reader method provides access to the class value stored in the instance.
Attributes inherited from WrapperBase
Instance Method Summary collapse
-
#initialize(obj, name) ⇒ Utils::Patterns::Pattern
constructor
The initialize method sets up a new instance with the provided object and name.
Methods inherited from WrapperBase
Constructor Details
#initialize(obj, name) ⇒ Utils::Patterns::Pattern
The initialize method sets up a new instance with the provided object and name.
This method configures the instance by storing a reference to the object’s class and creating a description string that combines the name with the class name.
407 408 409 410 411 |
# File 'lib/utils/irb.rb', line 407 def initialize(obj, name) super(name) @klass = obj.class @description = "#@name:#@klass" end |
Instance Attribute Details
#klass ⇒ Object (readonly)
The klass reader method provides access to the class value stored in the instance.
416 417 418 |
# File 'lib/utils/irb.rb', line 416 def klass @klass end |