metanorma / pubid-iso

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

Exclude edition #261

Closed andrew2net closed 6 months ago

andrew2net commented 7 months ago

To have edition in urn output I add edition to pubid, but then it's impossible to exclude the edition:


id1 = Pubid::Iso::Identifier.parse('ISO 7029/Amd 1')
=> #<Pubid::Iso::Identifier::Amendment:0x000000012790a010 @base=#<Pubid::Iso::Identifier::InternationalStandard:0x000000012790a150 @edition=nil, @month=nil, @number="7029", @publisher...

id1.root.edition = '3'
=> "3"

id1.urn
=> "urn:iso:std:iso:7029:ed-3:amd:1:v1"

id1.exclude(:edition) == id2
=> false

id1.exclude(:edition).to_h
=> {:publisher=>"", :number=>"1", :base=>{:edition=>"3", :number=>"7029", :publisher=>"ISO", :month=>nil, :type=>nil}, :edition=>nil, :month=>nil, :type=>"AMD"}
mico commented 7 months ago

Because id1.exclude(:edition) applies for amendment, not base document. Related discussion was here https://github.com/metanorma/pubid-iso/issues/258