Class: YARD::Parser::Rustdoc::Statements::Base
- Inherits:
-
Object
- Object
- YARD::Parser::Rustdoc::Statements::Base
- Defined in:
- lib/yard-rustdoc/statements.rb
Instance Method Summary collapse
-
#comments_hash_flag ⇒ Object
Not sure what should go here either.
- #comments_range ⇒ Object
- #docstring ⇒ Object
- #file ⇒ Object
-
#initialize(rustdoc) ⇒ Base
constructor
A new instance of Base.
- #line ⇒ Object
- #line_range ⇒ Object
- #show ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(rustdoc) ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 |
# File 'lib/yard-rustdoc/statements.rb', line 6 def initialize(rustdoc) @rustdoc = rustdoc @name = nil @parameters = [] end |
Instance Method Details
#comments_hash_flag ⇒ Object
Not sure what should go here either
47 48 |
# File 'lib/yard-rustdoc/statements.rb', line 47 def comments_hash_flag end |
#comments_range ⇒ Object
50 51 |
# File 'lib/yard-rustdoc/statements.rb', line 50 def comments_range end |
#docstring ⇒ Object
12 13 14 15 |
# File 'lib/yard-rustdoc/statements.rb', line 12 def docstring @docstring ||= rust_docstring .gsub(/^\s*@yard\s*\n/m, "") # remove @yard line end |
#file ⇒ Object
38 39 40 |
# File 'lib/yard-rustdoc/statements.rb', line 38 def file @rustdoc.dig("span", "filename") end |
#line ⇒ Object
30 31 32 |
# File 'lib/yard-rustdoc/statements.rb', line 30 def line line_range.first end |
#line_range ⇒ Object
34 35 36 |
# File 'lib/yard-rustdoc/statements.rb', line 34 def line_range @rustdoc.dig("span", "begin", 0)...@rustdoc.dig("span", "end", 0) end |
#show ⇒ Object
42 43 44 |
# File 'lib/yard-rustdoc/statements.rb', line 42 def show @rustdoc.to_s end |
#source ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/yard-rustdoc/statements.rb', line 17 def source return if file.nil? File.read(file) .lines .slice(line_index_range) .join rescue Errno::ENOENT log.warn("can't read '#{file}', cwd='#{Dir.pwd}'") "" end |