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.
244 245 246 247 248 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 244 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
239 240 241 242 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 239 def self.doc_from_source_location(source_location) return unless source_location new(*source_location).method_doc end |
Instance Method Details
#method_doc ⇒ Object
250 251 252 253 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 250 def method_doc parse @method_doc end |
#on_comment(token) ⇒ Object
266 267 268 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 266 def on_comment(token) (@last_comment_block ||= []) << token end |
#on_sp(token) ⇒ Object
270 271 272 |
# File 'lib/method_extensions/method/source_with_doc.rb', line 270 def on_sp(token) @last_comment_block << token if @last_comment_block end |