Method: Thor::Base.register_klass_file
- Defined in:
- lib/thor/base.rb
.register_klass_file(klass) ⇒ Object
Whenever a class inherits from Thor or Thor::Group, we should track the class and the file on Thor::Base. This is the method responsible for it.
145 146 147 148 149 150 151 |
# File 'lib/thor/base.rb', line 145 def register_klass_file(klass) #:nodoc: file = caller[1].match(/(.*):\d+/)[1] Thor::Base.subclasses << klass unless Thor::Base.subclasses.include?(klass) file_subclasses = Thor::Base.subclass_files[File.(file)] file_subclasses << klass unless file_subclasses.include?(klass) end |