relaton / relaton-ccsds

Implement relaton-ccsds for www.ccsds.org Standards
1 stars 0 forks source link

Pubid integration #10

Closed mico closed 3 months ago

mico commented 4 months ago

closes #7

mico commented 4 months ago

Tests are passing, but getting error during manual testing:

3.2.2 :007 > RelatonCcsds::DataFetcher.fetch
Started at: 2024-08-03 11:40:08 +0700
/Users/mico/.rvm/gems/ruby-3.2.2/gems/relaton-bib-1.19.3/lib/relaton_bib/bibliographic_item.rb:345:in `makeid': undefined method `gsub' for #<Pubid::Ccsds::Identifier::Base:0x00000001108c79e8 @publisher="CCSDS", @number="230", @book_color="G", @part=2, @retired=false, @edition="1"> (NoMethodError)

      idstr = identifier.id.gsub(/[:\/]/, "-").gsub(/[\s\(\)]/, "")
                           ^^^^^
    from /Users/mico/.rvm/gems/ruby-3.2.2/gems/relaton-bib-1.19.3/lib/relaton_bib/bibliographic_item.rb:241:in `initialize'
andrew2net commented 3 months ago

Tests are passing, but getting error during manual testing:

3.2.2 :007 > RelatonCcsds::DataFetcher.fetch
Started at: 2024-08-03 11:40:08 +0700
/Users/mico/.rvm/gems/ruby-3.2.2/gems/relaton-bib-1.19.3/lib/relaton_bib/bibliographic_item.rb:345:in `makeid': undefined method `gsub' for #<Pubid::Ccsds::Identifier::Base:0x00000001108c79e8 @publisher="CCSDS", @number="230", @book_color="G", @part=2, @retired=false, @edition="1"> (NoMethodError)

      idstr = identifier.id.gsub(/[:\/]/, "-").gsub(/[\s\(\)]/, "")
                           ^^^^^
  from /Users/mico/.rvm/gems/ruby-3.2.2/gems/relaton-bib-1.19.3/lib/relaton_bib/bibliographic_item.rb:241:in `initialize'

The RelatonBib::DcumentIdentifier#id method initially was designed to return string. This method used widely across relaton-* gems. Please don't change existed methods arguments and return types. Let's stick to the Open Close principle.