lib/relaton_itu/pubid.rb in relaton-itu-1.16.1 vs lib/relaton_itu/pubid.rb in relaton-itu-1.16.2

- old
+ new

@@ -63,12 +63,12 @@ def self.parse(id) id_parts = Parser.new.parse(id).to_h.transform_values(&:to_s) new(**id_parts) rescue Parslet::ParseFailed => e - warn "[relaton-itu] WARNING: #{id} is invalid ITU publication identifier" - warn e.parse_failure_cause.ascii_tree + Util.warn "WARNING: `#{id}` is invalid ITU publication identifier \n" \ + "#{e.parse_failure_cause.ascii_tree}" raise e end def to_h(with_type: true) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity hash = { prefix: prefix, sector: sector, code: code } @@ -94,14 +94,15 @@ s << date_to_s s << " Amd #{amd}" if amd s end - def ===(other) + def ===(other, ignore_args = []) hash = to_h with_type: false other_hash = other.to_h with_type: false hash.delete(:month) other_hash.delete(:month) + hash.delete(:year) if ignore_args.include?(:year) other_hash.delete(:year) unless hash[:year] hash == other_hash end private