Skip to content

Commit 54ae4d4

Browse files
committed
Improve documentation of URI#pname and URI#qname when using the prefixes keyword argument. (Fixes #73).
1 parent 5b09168 commit 54ae4d4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

lib/rdf/model/uri.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,8 @@ def parent
627627
# RDF::URI('http://www.w3.org/2000/01/rdf-schema#').qname #=> [:rdfs, nil]
628628
# RDF::URI('http://www.w3.org/2000/01/rdf-schema#label').qname #=> [:rdfs, :label]
629629
# RDF::RDFS.label.qname #=> [:rdfs, :label]
630+
# RDF::Vocab::DC.title.qname(
631+
# prefixes: {dcterms: 'http://purl.org/dc/terms/'}) #=> [:dcterms, :title]
630632
#
631633
# @param [Hash{Symbol => String}] prefixes
632634
# Explicit set of prefixes to look for matches, defaults to loaded vocabularies.
@@ -661,9 +663,15 @@ def qname(prefixes: nil)
661663
##
662664
# Returns a string version of the QName or the full IRI
663665
#
666+
# @example Using a custom prefix for creating a PNname.
667+
# RDF::URI('http://purl.org/dc/terms/creator').
668+
# pname(prefixes: {dcterms: 'http://purl.org/dc/terms/'})
669+
# #=> "dcterms:creator"
670+
#
664671
# @param [Hash{Symbol => String}] prefixes
665672
# Explicit set of prefixes to look for matches, defaults to loaded vocabularies.
666673
# @return [String] or `nil`
674+
# @see #qname
667675
def pname(prefixes: nil)
668676
(q = self.qname(prefixes: prefixes)) ? q.join(":") : to_s
669677
end

0 commit comments

Comments
 (0)