class RDocRuboCop::Lang::C::Comment
Attributes
comment_text[R]
offset_begin[R]
offset_end[R]
source_file[R]
Public Class Methods
build(comment_text, source_file, offset_begin, offset_end)
click to toggle source
# File lib/rdoc_rubocop/lang/c/comment.rb, line 12 def self.build(comment_text, source_file, offset_begin, offset_end) body = comment_text.dup first_line = body.slice!(/\A.*\R/) klass = if first_line.nil? Comment::OneLine elsif first_line.match?(%r(^/\*[\x21-\x2f\x3a-\x3f])) || !body.match?(/\A *\*/) Comment::Banner else Comment::Normal end klass.new(comment_text, source_file, offset_begin, offset_end) end
new(comment_text, source_file, offset_begin, offset_end)
click to toggle source
# File lib/rdoc_rubocop/lang/c/comment.rb, line 28 def initialize(comment_text, source_file, offset_begin, offset_end) @comment_text = comment_text @source_file = source_file @offset_begin = offset_begin @offset_end = offset_end end
Public Instance Methods
length()
click to toggle source
def corrected_text end
# File lib/rdoc_rubocop/lang/c/comment.rb, line 38 def length @offset_end - @offset_begin end
Private Instance Methods
text_without_commentchar()
click to toggle source
# File lib/rdoc_rubocop/lang/c/comment.rb, line 44 def text_without_commentchar parse unless @body @body end