Class: RDocRuboCop::Lang::C::Comment
- Inherits:
-
Base::Comment
- Object
- Base::Comment
- RDocRuboCop::Lang::C::Comment
- Defined in:
- lib/rdoc_rubocop/lang/c/comment.rb,
lib/rdoc_rubocop/lang/c/comment/banner.rb,
lib/rdoc_rubocop/lang/c/comment/normal.rb,
lib/rdoc_rubocop/lang/c/comment/one_line.rb
Defined Under Namespace
Classes: Banner, Normal, OneLine
Instance Attribute Summary collapse
-
#comment_text ⇒ Object
readonly
Returns the value of attribute comment_text.
-
#offset_begin ⇒ Object
readonly
Returns the value of attribute offset_begin.
-
#offset_end ⇒ Object
readonly
Returns the value of attribute offset_end.
-
#source_file ⇒ Object
readonly
Returns the value of attribute source_file.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(comment_text, source_file, offset_begin, offset_end) ⇒ Comment
constructor
A new instance of Comment.
-
#length ⇒ Object
def corrected_text end.
Methods inherited from Base::Comment
Constructor Details
#initialize(comment_text, source_file, offset_begin, offset_end) ⇒ Comment
Returns a new instance of Comment.
28 29 30 31 32 33 |
# 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 |
Instance Attribute Details
#comment_text ⇒ Object (readonly)
Returns the value of attribute comment_text.
7 8 9 |
# File 'lib/rdoc_rubocop/lang/c/comment.rb', line 7 def comment_text @comment_text end |
#offset_begin ⇒ Object (readonly)
Returns the value of attribute offset_begin.
9 10 11 |
# File 'lib/rdoc_rubocop/lang/c/comment.rb', line 9 def offset_begin @offset_begin end |
#offset_end ⇒ Object (readonly)
Returns the value of attribute offset_end.
10 11 12 |
# File 'lib/rdoc_rubocop/lang/c/comment.rb', line 10 def offset_end @offset_end end |
#source_file ⇒ Object (readonly)
Returns the value of attribute source_file.
8 9 10 |
# File 'lib/rdoc_rubocop/lang/c/comment.rb', line 8 def source_file @source_file end |
Class Method Details
.build(comment_text, source_file, offset_begin, offset_end) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# 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 |
Instance Method Details
#length ⇒ Object
def corrected_text end
38 39 40 |
# File 'lib/rdoc_rubocop/lang/c/comment.rb', line 38 def length @offset_end - @offset_begin end |