Class: Yamlint::Parser::CommentExtractor
- Inherits:
-
Object
- Object
- Yamlint::Parser::CommentExtractor
- Defined in:
- lib/yamlint/parser/comment_extractor.rb
Constant Summary collapse
- COMMENT_PATTERN =
/#(.*)$/
Instance Method Summary collapse
- #extract ⇒ Object
-
#initialize(content) ⇒ CommentExtractor
constructor
A new instance of CommentExtractor.
Constructor Details
#initialize(content) ⇒ CommentExtractor
Returns a new instance of CommentExtractor.
39 40 41 |
# File 'lib/yamlint/parser/comment_extractor.rb', line 39 def initialize(content) @content = content end |
Instance Method Details
#extract ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/yamlint/parser/comment_extractor.rb', line 43 def extract comments = [] @content.lines.each_with_index do |line, index| line_number = index + 1 extract_comments_from_line(line, line_number, comments) end comments end |