|
Warning
|
This gem is deprecated and no longer maintained. The per-flavor PubID gems have been superseded by pubid 2.0 — the unified PubID library implementing the publication identifiers of all standards bodies. Please use pubid ~> 2.0, and open issues and pull requests at metanorma/pubid. |
Publication identifiers parsing library
Usage
Exclude attributes when compare
require "pubid-core"
pubid_first = Identifier.parse("ISO 1:1999")
pubid_second = Identifier.parse("ISO 1")
pubid_first == pubid_second
=> false
pubid_first.exclude(:year) == pubid_second
=> trueUsing #to_h to convert identifier to hash
require "pubid-core"
pubid = Identifier.parse("ISO 1:1999")
pubid.to_h
=> { publisher: "ISO", number: 1, year: 1999 }Using #new_edition_of? to compare identifiers
require "pubid-core"
pubid_first = Identifier.parse("ISO 1:1999")
pubid_second = Identifier.parse("ISO 1:2000")
pubid_first.new_edition_of?(pubid_second)
=> false
pubid_second.new_edition_of?(pubid_first)
=> true