Class: IRB::Kit::Handlers::Descender
- Defined in:
- lib/irb/kit/handlers/descender.rb
Overview
Handles finding the descendants of a class.
Instance Method Summary collapse
- #call(name) ⇒ Object
-
#initialize(collector: ObjectSpace) ⇒ Descender
constructor
A new instance of Descender.
Constructor Details
#initialize(collector: ObjectSpace) ⇒ Descender
Returns a new instance of Descender.
8 9 10 11 |
# File 'lib/irb/kit/handlers/descender.rb', line 8 def initialize(collector: ObjectSpace, **) @collector = collector super(**) end |
Instance Method Details
#call(name) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/irb/kit/handlers/descender.rb', line 13 def call name collect(name).then { |all| all.empty? ? "No descendants found." : all.join("\n") } .then { |result| io.puts result } rescue NameError io.puts "ERROR: #{name.inspect} doesn't exist." end |