lib/.rbnext/3.0/anyway/tracing.rb in anyway_config-2.5.4 vs lib/.rbnext/3.0/anyway/tracing.rb in anyway_config-2.6.0
- old
+ new
@@ -24,32 +24,32 @@
def dig(...)
value.dig(...)
end; respond_to?(:ruby2_keywords, true) && (ruby2_keywords :dig)
- def record_value(val, *path, **opts)
+ def record_value(val, *path, **__kwrest__)
key = path.pop
trace = if val.is_a?(Hash)
- Trace.new.tap { _1.merge_values(val, **opts) }
+ Trace.new.tap { it = _1;it.merge_values(val, **__kwrest__) }
else
- Trace.new(:value, val, **opts)
+ Trace.new(:value, val, **__kwrest__)
end
target_trace = path.empty? ? self : value.dig(*path)
target_trace.record_key(key.to_s, trace)
val
end
- def merge_values(hash, **opts)
+ def merge_values(hash, **__kwrest__)
return hash unless hash
hash.each do |key, val|
if val.is_a?(Hash)
- value[key.to_s].merge_values(val, **opts)
+ value[key.to_s].merge_values(val, **__kwrest__)
else
- value[key.to_s] = Trace.new(:value, val, **opts)
+ value[key.to_s] = Trace.new(:value, val, **__kwrest__)
end
end
hash
end
@@ -82,11 +82,11 @@
def trace?() ; type == :trace; end
def to_h
if trace?
- value.transform_values(&:to_h).tap { _1.default_proc = nil }
+ value.transform_values(&:to_h).tap { it = _1;it.default_proc = nil }
else
{value: value, source: source}
end
end
@@ -172,16 +172,16 @@
end
end
module_function
- def trace!(type, *path, **opts)
+ def trace!(type, *path, **__kwrest__)
return yield unless Tracing.tracing?
val = yield
if val.is_a?(Hash)
- Tracing.current_trace.merge_values(val, type: type, **opts)
+ Tracing.current_trace.merge_values(val, type: type, **__kwrest__)
elsif !path.empty?
- Tracing.current_trace.record_value(val, *path, type: type, **opts)
+ Tracing.current_trace.record_value(val, *path, type: type, **__kwrest__)
end
val
end
end
end