Class: Philiprehberger::TomlKit::CommentPreservingParser

Inherits:
Object
  • Object
show all
Defined in:
lib/philiprehberger/toml_kit/comment_document.rb

Overview

Parser that tracks comments alongside parsed data.

Instance Method Summary collapse

Instance Method Details

#parse(input) ⇒ CommentDocument

Parameters:

  • input (String)

    TOML document

Returns:



65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/philiprehberger/toml_kit/comment_document.rb', line 65

def parse(input)
  @lines = input.lines
  @data = {}
  @comments = {}
  @table_comments = {}
  @header_comments = []
  @current_path = []
  @pending_comments = []

  parse_lines
  CommentDocument.new(@data, comments: @comments, table_comments: @table_comments,
                             header_comments: @header_comments)
end