Class: MethodExtensions::MethodSourceWithDoc::MethodDocRipper
- Inherits:
-
Ripper
- Object
- Ripper
- MethodExtensions::MethodSourceWithDoc::MethodDocRipper
- Defined in:
- lib/method_extensions/method/source_with_doc.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(filename, method_definition_lineno) ⇒ MethodDocRipper
constructor
A new instance of MethodDocRipper.
- #method_doc ⇒ Object
- #on_comment(token) ⇒ Object
- #on_sp(token) ⇒ Object
Constructor Details
#initialize(filename, method_definition_lineno) ⇒ MethodDocRipper
Returns a new instance of MethodDocRipper.
200 201 202 203 204 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 200 def initialize(filename, method_definition_lineno) super(IO.read(filename), filename) @method_definition_lineno = method_definition_lineno @last_comment_block = nil end |
Class Method Details
.doc_from_source_location(source_location) ⇒ Object
195 196 197 198 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 195 def self.doc_from_source_location(source_location) return unless source_location new(*source_location).method_doc end |
Instance Method Details
#method_doc ⇒ Object
206 207 208 209 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 206 def method_doc parse @method_doc end |
#on_comment(token) ⇒ Object
222 223 224 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 222 def on_comment(token) (@last_comment_block ||= []) << token end |
#on_sp(token) ⇒ Object
226 227 228 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 226 def on_sp(token) @last_comment_block << token if @last_comment_block end |