You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/rdf/model/list.rb
+29-4Lines changed: 29 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -49,14 +49,23 @@ def self.[](*values)
49
49
# g = RDF::Graph.new << l
50
50
# g.count # => l.count
51
51
#
52
+
# @example use a transaction for block initialization
53
+
# l = RDF::List(graph: graph, wrap_transaction: true) do |list|
54
+
# list << RDF::Literal(1)
55
+
# # list.graph.rollback will rollback all list changes within this block.
56
+
# end
57
+
# list.count #=> 1
58
+
#
52
59
# @param [RDF::Resource] subject (RDF.nil)
53
60
# Subject should be an {RDF::Node}, not a {RDF::URI}. A list with an IRI head will not validate, but is commonly used to detect if a list is valid.
54
61
# @param [RDF::Graph] graph (RDF::Graph.new)
55
62
# @param [Array<RDF::Term>] values
56
63
# Any values which are not terms are coerced to `RDF::Literal`.
64
+
# @param [Boolean] wrap_transaction (false)
65
+
# Wraps the callback in a transaction, and replaces the graph with that transaction for the duraction of the callback. This has the effect of allowing any list changes to be made atomically, or rolled back.
0 commit comments