metanorma / pubid-iso

Implementation of ISO pubid
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

URGENT! Incorrect Pubid object created from Amendment's #to_h output #248

Closed andrew2net closed 7 months ago

andrew2net commented 7 months ago
> id = Pubid::Iso::Identifier.parse("ISO 19115-2:2019/Amd 1:2022")
=> #<Pubid::Iso::Identifier::Amendment:0x0000000110518220 @base=#<Pubid::Iso::Identifier::InternationalStandard:0x0000000110518360 @edition=nil, @number="19115"@4, @part="2"@10, @publi...

> hash = id.to_h
=> {:publisher=>"", :number=>"1"@21, :year=>2022, :base=>{:publisher=>"ISO", :number=>"19115"@4, :year=>2019, :part=>"2"@10, :edition=>nil, :type=>nil}, :edition=>nil, :type=>nil}

> id2 = Pubid::Iso::Identifier.create(**hash)
=> #<Pubid::Iso::Identifier::InternationalStandard:0x00000001128f5b48 @base={:publisher=>"ISO", :number=>"19115"@4, :year=>2019, :part=>"2"@10, :edition=>nil, :type=>nil}, @edition=nil...

> id2.to_s
=> " 1:2022"
ronaldtse commented 7 months ago

@mico can you please help fix this ASAP and incorporate this test? Thanks!

mico commented 7 months ago

@andrew2net Try to update pubid-core to 1.12.2 and use latest pubid-iso (0.7.1 - I just released it)

Upd. just discovered the problem with "type" value in returning hash, working on fix

mico commented 7 months ago

@ronaldtse @andrew2net Found the problem (didn't update type definitions), added solution in pull request.