Class: IRB::Kit::Helpers::ConstantSource
- Inherits:
-
HelperMethod::Base
- Object
- HelperMethod::Base
- IRB::Kit::Helpers::ConstantSource
- Defined in:
- lib/irb/kit/helpers/constant_source.rb
Overview
Finds constant’s source location.
Constant Summary collapse
- MONIKER =
:csource
Instance Method Summary collapse
- #execute(name) ⇒ Object
-
#initialize(object = Object) ⇒ ConstantSource
constructor
A new instance of ConstantSource.
Constructor Details
#initialize(object = Object) ⇒ ConstantSource
Returns a new instance of ConstantSource.
12 13 14 15 |
# File 'lib/irb/kit/helpers/constant_source.rb', line 12 def initialize object = Object super() @object = object end |
Instance Method Details
#execute(name) ⇒ Object
17 18 19 20 21 |
# File 'lib/irb/kit/helpers/constant_source.rb', line 17 def execute name object.const_source_location name rescue NameError "ERROR: Invalid constant (#{name.inspect})." end |