Merge pull request #299 from olleolleolle/fix/reader-doc-comment
[refactor] Fix docblock datatype, use #map
This commit is contained in:
commit
dfdeb0e633
|
@ -62,22 +62,19 @@ module GitHubChangelogGenerator
|
||||||
captures
|
captures
|
||||||
end
|
end
|
||||||
|
|
||||||
# Parse the given ChangeLog data into a Hash
|
# Parse the given ChangeLog data into a list of Hashes
|
||||||
#
|
#
|
||||||
# @param [String] data File data from the ChangeLog.md
|
# @param [String] data File data from the ChangeLog.md
|
||||||
# @return [Hash] Parsed data, e.g. [{ 'version' => ..., 'url' => ..., 'date' => ..., 'content' => ...}, ...]
|
# @return [Array<Hash>] Parsed data, e.g. [{ 'version' => ..., 'url' => ..., 'date' => ..., 'content' => ...}, ...]
|
||||||
def parse(data)
|
def parse(data)
|
||||||
sections = data.split(/^## .+?$/)
|
sections = data.split(/^## .+?$/)
|
||||||
headings = data.scan(/^## .+?$/)
|
headings = data.scan(/^## .+?$/)
|
||||||
changelog = []
|
|
||||||
|
|
||||||
headings.each_with_index do |heading, index|
|
headings.each_with_index.map do |heading, index|
|
||||||
captures = parse_heading(heading)
|
section = parse_heading(heading)
|
||||||
captures["content"] = sections.at(index + 1)
|
section["content"] = sections.at(index + 1)
|
||||||
changelog.push captures
|
section
|
||||||
end
|
end
|
||||||
|
|
||||||
changelog
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def read(file_path)
|
def read(file_path)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user