lib/github_changelog_generator/generator/generator.rb
def parse_by_sections(issues, pull_requests)
      issues_a = []
      enhancement_a = []
      bugs_a = []

      issues.each do |dict|
        added = false
        dict["labels"].each do |label|
          if options[:bug_labels].include?(label["name"])
            bugs_a.push(dict)
            added = true
            next
          end
          if options[:enhancement_labels].include?(label["name"])
            enhancement_a.push(dict)
            added = true
            next
          end
        end
        issues_a.push(dict) unless added
      end

      added_pull_requests = []
      pull_requests.each do |pr|
        pr["labels"].each do |label|
          if options[:bug_labels].include?(label["name"])
            bugs_a.push(pr)
            added_pull_requests.push(pr)
            next
          end
          if options[:enhancement_labels].include?(label["name"])
            enhancement_a.push(pr)
            added_pull_requests.push(pr)
            next
          end
        end
      end
      added_pull_requests.each { |p| pull_requests.delete(p) }

      [bugs_a, enhancement_a, issues_a]
    end
# This method sort issues by types
# (bugs, features, or just closed issues) by labels
#
# @param [Array] issues
# @param [Array] pull_requests
# @return [Array] tuple of filtered arrays: (Bugs, Enhancements Issues)
This method sort issues by types
(bugs, features, or just closed issues) by labels
This method sort issues by types ( bugs features or just closed issues ) by labels
def parse_by_sections(issues, pull_requests)
      issues_a = []
      enhancement_a = []
      bugs_a = []
      issues.each do |dict|
        added = false
        dict["labels"].each do |label|
          if options[:bug_labels].include?(label["name"])
            bugs_a.push(dict)
            added = true
            next
          end
          if options[:enhancement_labels].include?(label["name"])
            enhancement_a.push(dict)
            added = true
            next
          end
        end
        issues_a.push(dict) unless added
      end
      added_pull_requests = []
      pull_requests.each do |pr|
        pr["labels"].each do |label|
          if options[:bug_labels].include?(label["name"])
            bugs_a.push(pr)
            added_pull_requests.push(pr)
            next
          end
          if options[:enhancement_labels].include?(label["name"])
            enhancement_a.push(pr)
            added_pull_requests.push(pr)
            next
          end
        end
      end
      added_pull_requests.each { |p| pull_requests.delete(p) }
      [bugs_a, enhancement_a, issues_a]
    end
def parse_by_sections ( issues , pull_requests ) issues_a = [ ] enhancement_a = [ ] bugs_a = [ ] issues . each do | dict | added = false dict [ "labels" ] . each do | label | if options [ :bug_labels ] . include? ( label [ "name" ] ) bugs_a . push ( dict ) added = true next end if options [ :enhancement_labels ] . include? ( label [ "name" ] ) enhancement_a . push ( dict ) added = true next end end issues_a . push ( dict ) unless added end added_pull_requests = [ ] pull_requests . each do | pr | pr [ "labels" ] . each do | label | if options [ :bug_labels ] . include? ( label [ "name" ] ) bugs_a . push ( pr ) added_pull_requests . push ( pr ) next end if options [ :enhancement_labels ] . include? ( label [ "name" ] ) enhancement_a . push ( pr ) added_pull_requests . push ( pr ) next end end end added_pull_requests . each { | p | pull_requests . delete ( p ) } [ bugs_a , enhancement_a , issues_a ] end
This method sort issues by types
(bugs, features, or just closed issues) by labels
This method sort issues by types ( bugs features or just closed issues ) by labels
tuple of filtered arrays: (Bugs, Enhancements Issues)
tuple of filtered arrays : ( Bugs Enhancements Issues )
Array
issues
pull_requests
None