Skip to content

Commit 92dfc02

Browse files
committed
Create Pattern#dup, which will recursively duplicate itself.
1 parent 2370666 commit 92dfc02

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/rdf/query/pattern.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ def initialize!
5959
super
6060
end
6161

62+
##
63+
# Create a new pattern from the quads, recursivly dupping sub-patterns.
64+
def dup
65+
self.class.from(self.to_quad.map {|t| t.is_a?(RDF::Query::Pattern) ? t.dup : t})
66+
end
67+
6268
##
6369
# Any additional options for this pattern.
6470
#

0 commit comments

Comments
 (0)