Project

pubid-core

0.0
The project is in a healthy, maintained state
Library to generate, parse and manipulate PubID.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0
~> 3.0

Runtime

 Project Readme

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
=> true

Using #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