lib/datacite/mapping/contributor.rb in datacite-mapping-0.2.5 vs lib/datacite/mapping/contributor.rb in datacite-mapping-0.3.0

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require 'xml/mapping_extensions' require 'datacite/mapping/name_identifier' module Datacite module Mapping @@ -90,16 +92,16 @@ self.affiliations = affiliations || [] self.type = type end def name=(value) - new_value = value && value.strip - fail ArgumentError, 'Name cannot be empty or nil' unless new_value && !new_value.empty? + new_value = value&.strip + raise ArgumentError, 'Name cannot be empty or nil' unless new_value && !new_value.empty? @name = new_value end def type=(value) - fail ArgumentError, 'Type cannot be nil' unless value + raise ArgumentError, 'Type cannot be nil' unless value @type = value end # @!attribute [rw] name # @return [String] the personal name of the contributor, in the format `Family, Given`. Cannot be empty or nil