module Sequel::Dataset::Provenance
Constants
- INTERNAL
- RUBY_STDLIB
- SEQUEL_LIB_PATH
Public Instance Methods
clone(opts = nil || (return self))
click to toggle source
Include provenance information when cloning datasets.
Calls superclass method
# File lib/sequel/extensions/provenance.rb 45 def clone(opts = nil || (return self)) 46 super(provenance_opts(opts)) 47 end
Private Instance Methods
provenance_opts(opts)
click to toggle source
Return a copy of opts with provenance information added.
# File lib/sequel/extensions/provenance.rb 87 def provenance_opts(opts) 88 provenance = {source: provenance_source, keys: opts.keys.freeze}.freeze 89 opts = opts.dup 90 opts[:provenance] = ((@opts[:provenance] || EMPTY_ARRAY).dup << provenance).freeze 91 opts 92 end
provenance_source()
click to toggle source
Return the caller line for the provenance change. This skips Sequel
itself and the standard library. Additional locations can be skipped using the :provenance_caller_ignore Dataset
option.
# File lib/sequel/extensions/provenance.rb 97 def provenance_source 98 ignore = db.opts[:provenance_caller_ignore] 99 caller.find do |line| 100 !(line.start_with?(SEQUEL_LIB_PATH) || 101 line.start_with?(RUBY_STDLIB) || 102 line.start_with?(INTERNAL) || 103 (ignore && line =~ ignore)) 104 end 105 end