Closed andrew2net closed 1 year ago
@andrew2net we already have a method doing the same: #get_params
, but #to_h
will better reflect purpose of the method, so I'm renaming it.
@mico we need to document all the Pubid methods. You can use https://yardoc.org so we automatically get docs like this https://www.rubydoc.info/gems/relaton-bib/1.16.2/RelatonBib/Affiliation
When using "typed stages" with input like:
{ type: "tr", number: 1, publisher: "ISO", stage: :dtr }
#to_h
returns:
{:number=>1, :publisher=>"ISO", :stage=>#<Pubid::Core::Stage:0x000000010a7e31b8 @config=#<Pubid::Core...>{:long=>"Technical Report", :short=>"TR"}}>, @stages=["40.00"]>>, :type=>"tr", :typed_stage=>"DTR"}
which cannot be used to rebuild identifier again because of typed_stage
parameter that we don't accept for constructor, "typed stage" should be applied through stage
parameter.
@mico can we create Pubid::Core::Stage#to_h
method? We need to serialize Pbid as a Hash and store in YAML file. And we need to be able to recreate the Pubid from the Hash. If it's impossible to create the stage
parameter in Pubid constructor, let's make Pubid#from_hash
parser method.
We store parts of ID in index file. We need to get these pars from pubid with method
to_h
and recreate PubID from the hash: