All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.
2.0.2 - 2017-01-13
.extract
now respects the word boundaries at the beginning of URNs. Example:sideburn:mutton:chops
won't return['urn:mutton:chops']
but[]
.
2.0.1 - 2016-03-24
URN()
shortcut works on classes withoutObject
as ancestor.
2.0.0 - 2016-03-22
- Only return
URN
instances for validURN
s at creation. RaiseURN::InvalidURNError
otherwise. #normalize
returns a normalizedURN
object instead of itsString
representation. You can get the normalizedString
representation with.normalize.to_s
- Do not allow hexadecimal numbers from 0 to 20 and from 7F to FF. See RFC2141 section "2.4 Excluded characters".
- Shortcut method (
URN()
) at creation:
urn = URN('URN:Name:Spec')
#=> #<URN:0x007fd97a835558 @urn="URN:Name:Spec">
REGEX
into the API documentation#nid
returns the namespace identifier part.
URN('URN:Name:Spec').nid
#=> "Name"
#nss
returns the namespace specific string part.
URN('URN:Name:Spec').nss
#=> "Spec"
#to_s
returns theString
representation.
URN('URN:Name:Spec').to_s
#=> "URN:Name:Spec"
#===(other)
returns true if the URN objects are equivalent. This method normalizes both URNs before doing the comparison, and allows comparison against Strings.#==(other)
returns true if the URN objects are equivalent. This method normalizes both URNs before doing the comparison.#eql?(other)
returns true if the URN objects are equal. This method does NOT normalize either URN before doing the comparison..extract(str)
attempts to parse and merge a set of URNs. If noblock
is given, then returns the result as anArray
. Else it callsblock
for each element in result and returnsnil
.- URN initialization accepts a
URN
as argument:
URN(URN('urn:foo:bar'))
#=> #<URN:0x007f85040434c8 @urn="urn:foo:bar">
#valid?
. Validity check is now at object creation time, therefore all instances ofURN
are valid.
1.0.0 - 2016-03-09
- The library is now RFC2141 compliant.
0.1.3 - 2016-03-07
- Explicitly require CGI standard library
0.1.2 - 2016-03-02
- Extract the
URN
pattern to a separate variable, so that it's easier to use it in different Regex formats if needed.
0.1.1 - 2016-03-02
- Stricter rules to validate a URN: it does not accept
urn
string as valid namespace identifier.
0.1.0 - 2016-03-01
- First version with basic implementation.