lib/rbs/namespace.rb in rbs-0.2.0 vs lib/rbs/namespace.rb in rbs-0.3.0
- old
+ new
@@ -85,7 +85,25 @@
new(path: string.split("::").drop(1).map(&:to_sym), absolute: true)
else
new(path: string.split("::").map(&:to_sym), absolute: false)
end
end
+
+
+ def ascend
+ if block_given?
+ current = self
+
+ until current.empty?
+ yield current
+ current = current.parent
+ end
+
+ yield current
+
+ self
+ else
+ enum_for(:ascend)
+ end
+ end
end
end