Skip to content

Commit

Permalink
move hash inside method
Browse files Browse the repository at this point in the history
  • Loading branch information
mccalluc committed Dec 7, 2022
1 parent 374e6c8 commit 0a2cede
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/models/pdc_serialization/datacite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ def self.new_from_work_resource(resource)
# rubocop: enable Metrics/MethodLength

class << self
resource_types = Datacite::Mapping::ResourceTypeGeneral.to_a.map { |ct| [ct.value, ct] }.to_h
def datacite_resource_type(resource_type)
resource_types = ::Datacite::Mapping::ResourceTypeGeneral.to_a.map { |ct| [ct.value, ct] }.to_h
::Datacite::Mapping::ResourceType.new(resource_type_general: resource_types[resource_type])
end

contributor_types = Datacite::Mapping::ContributorType.to_a.map { |ct| [ct.value, ct] }.to_h
def datacite_contributor_type(type)
contributor_types = ::Datacite::Mapping::ContributorType.to_a.map { |ct| [ct.value, ct] }.to_h
contributor_types[type]
end

Expand Down
2 changes: 1 addition & 1 deletion spec/models/pdc_serialization/datacite_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@

context "resource types" do
it "maps dataset" do
resource_type = described_class.datacite_resource_type("dataset")
resource_type = described_class.datacite_resource_type("Dataset")
expect(resource_type.resource_type_general.value).to eq "Dataset"
end
it "Audiovisual" do
Expand Down

0 comments on commit 0a2cede

Please sign in to comment.