Skip to content

Commit

Permalink
Rename #id_hash to #to_h
Browse files Browse the repository at this point in the history
Co-authored-by: Barry Gordon <896971+brrygrdn@users.noreply.github.com>
  • Loading branch information
Nishnha and brrygrdn committed Apr 25, 2023
1 parent 492c9c3 commit 5529ce8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions common/lib/dependabot/dependency_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@

module Dependabot
class DependencyGroup
attr_reader :name, :rules, :dependencies, :id
attr_reader :name, :rules, :dependencies

def initialize(name:, rules:)
@name = name
@rules = rules
@dependencies = []
@id = id_hash
end

def contains?(dependency)
@dependencies.include?(dependency) if @dependencies.any?
rules.any? { |rule| WildcardMatcher.match?(rule, dependency.name) }
end

private

def id_hash
def to_h
{ "name" => serialized_group_name }
end

private

def serialized_group_name
name.downcase.gsub("-", "_").to_sym
Expand Down
2 changes: 1 addition & 1 deletion updater/lib/dependabot/api_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def dependency_group_hash(dependency_change)
# FIXME: We currently assumpt that _an attempt_ to send a DependencyGroup#id should
# result in the `grouped-update` flag being set, regardless of whether the
# DependencyGroup actually exists.
{ "dependency-group": dependency_change.dependency_group.id }.compact
{ "dependency-group": dependency_change.dependency_group.to_h }.compact
end

def create_pull_request_data(dependency_change, base_commit_sha)
Expand Down

0 comments on commit 5529ce8

Please sign in to comment.