class Forspell::Loaders::Ruby

Constants

MAX_COMMENT_LENGTH

Public Class Methods

new(file: nil, text: nil) click to toggle source
Calls superclass method
# File lib/forspell/loaders/ruby.rb, line 12
def initialize(file: nil, text: nil)
  super
  @markup = RDoc::Markup.new
  @formatter = RDoc::Markup::ToMarkdown.new
  @formatter.width = MAX_COMMENT_LENGTH
end

Private Instance Methods

comments() click to toggle source
# File lib/forspell/loaders/ruby.rb, line 21
def comments
  YARD::Parser::Ruby::RubyParser.new(@input, @file).parse
    .tokens.select{ |type,| type == :comment }
    .reject{ |_, text,| text.start_with?('#  ') }
end
line(comment) click to toggle source
# File lib/forspell/loaders/ruby.rb, line 31
def line(comment)
  comment.last.first
end
text(comment) click to toggle source
# File lib/forspell/loaders/ruby.rb, line 27
def text(comment)
  @markup.convert(comment[1], @formatter)
end