Method: Code.grab_containing_method
- Defined in:
- lib/xiki/code.rb
.grab_containing_method(options = {}) ⇒ Object
Searches upward for “def…” and returns the line
776 777 778 779 780 781 782 783 784 785 |
# File 'lib/xiki/code.rb', line 776 def self.grab_containing_method ={} orig = Location.new Search.backward "^ def " txt = Line.value orig.go return txt[/def (self\.)?(\w+)/, 2] if [:name] txt end |