lib/csl/treelike.rb in csl-1.5.1 vs lib/csl/treelike.rb in csl-1.5.2
- old
+ new
@@ -228,10 +228,14 @@
# versions are marked with an exclamation mark as a reminder
# that the return values are cached and potentially outdated.
%w{ ancestors descendants siblings root depth }.each do |name|
ivar = "@#{name}"
define_method("#{name}!") do
- instance_variable_get(ivar) || send(name)
+ if instance_variable_defined?(ivar)
+ instance_variable_get(ivar)
+ else
+ send(name)
+ end
end
end
protected