From a178822c83ed12f4835fe9b9c5d0e30c6594d539 Mon Sep 17 00:00:00 2001 From: Andrew Waage Date: Mon, 23 May 2016 16:30:17 -0700 Subject: [PATCH] fixed some handling of hashes --- .../generator/generator_generation.rb | 5 +++-- .../generator/generator_processor.rb | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/github_changelog_generator/generator/generator_generation.rb b/lib/github_changelog_generator/generator/generator_generation.rb index d68ad5f..a139a55 100644 --- a/lib/github_changelog_generator/generator/generator_generation.rb +++ b/lib/github_changelog_generator/generator/generator_generation.rb @@ -119,8 +119,9 @@ module GitHubChangelogGenerator # # @return [Array] filtered issues and pull requests def filter_issues_for_tags(newer_tag, older_tag) - filtered_pull_requests = delete_by_time(@pull_requests, :actual_date, older_tag, newer_tag) - filtered_issues = delete_by_time(@issues, :actual_date, older_tag, newer_tag) + + filtered_pull_requests = delete_by_time(@pull_requests, 'actual_date', older_tag, newer_tag) + filtered_issues = delete_by_time(@issues, 'actual_date', older_tag, newer_tag) newer_tag_name = newer_tag.nil? ? nil : newer_tag["name"] diff --git a/lib/github_changelog_generator/generator/generator_processor.rb b/lib/github_changelog_generator/generator/generator_processor.rb index 7040ddc..61c4a4f 100644 --- a/lib/github_changelog_generator/generator/generator_processor.rb +++ b/lib/github_changelog_generator/generator/generator_processor.rb @@ -32,18 +32,18 @@ module GitHubChangelogGenerator # @return [Array] issues with milestone #tag_name def find_issues_to_add(all_issues, tag_name) all_issues.select do |issue| - if issue.milestone.nil? + if issue['milestone'].nil? false else # check, that this milestone in tag list: milestone_is_tag = @filtered_tags.find do |tag| - tag.name == issue.milestone.title + tag['name'] == issue['milestone']['title'] end if milestone_is_tag.nil? false else - issue.milestone.title == tag_name + issue['milestone']['title'] == tag_name end end end @@ -53,11 +53,11 @@ module GitHubChangelogGenerator def remove_issues_in_milestones(filtered_issues) filtered_issues.select! do |issue| # leave issues without milestones - if issue.milestone.nil? + if issue['milestone'].nil? true else # check, that this milestone in tag list: - @filtered_tags.find { |tag| tag.name == issue.milestone.title }.nil? + @filtered_tags.find { |tag| tag['name'] == issue['milestone']['title'] }.nil? end end end @@ -68,7 +68,7 @@ module GitHubChangelogGenerator # @param [String] older_tag all issues before this tag date will be excluded. May be nil, if it's first tag # @param [String] newer_tag all issue after this tag will be excluded. May be nil for unreleased section # @return [Array] filtered issues - def delete_by_time(issues, hash_key = :actual_date, older_tag = nil, newer_tag = nil) + def delete_by_time(issues, hash_key = 'actual_date', older_tag = nil, newer_tag = nil) # in case if not tags specified - return unchanged array return issues if older_tag.nil? && newer_tag.nil?