astrolabe 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/CHANGELOG.md +2 -0
- data/lib/astrolabe/node.rb +24 -0
- data/lib/astrolabe/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0261eb0ca33d240e771b36abd56920b8434a4fb7
|
4
|
+
data.tar.gz: 427cba57b3afdc25097c51554c98a3f7177214b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6372f0ce3b7208e01c1308061dbc50474fadeff0f4e6eafaece7f52b4661d35a81715bea5b3e758bce5ad508ff3450552077b3c6361e134d2ef9e0b17c5b89f
|
7
|
+
data.tar.gz: 275c1ce0a24de0ec1e28a7805b5939502ded932ed37c054f985f2760cff9169e4438761293429eedee709fbc1dda3e9395493f39695995ef690f1a3ff631c9b6
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/astrolabe/node.rb
CHANGED
@@ -95,6 +95,14 @@ module Astrolabe
|
|
95
95
|
self
|
96
96
|
end
|
97
97
|
|
98
|
+
# Returns an array of ancestor nodes.
|
99
|
+
# This is a shorthand for `node.each_ancestor.to_a`.
|
100
|
+
#
|
101
|
+
# @return [Array<Node>] an array of ancestor nodes
|
102
|
+
def ancestors
|
103
|
+
each_ancestor.to_a
|
104
|
+
end
|
105
|
+
|
98
106
|
# Calls the given block for each child node.
|
99
107
|
# If no block is given, an `Enumerator` is returned.
|
100
108
|
#
|
@@ -129,6 +137,14 @@ module Astrolabe
|
|
129
137
|
self
|
130
138
|
end
|
131
139
|
|
140
|
+
# Returns an array of child nodes.
|
141
|
+
# This is a shorthand for `node.each_child_node.to_a`.
|
142
|
+
#
|
143
|
+
# @return [Array<Node>] an array of child nodes
|
144
|
+
def child_nodes
|
145
|
+
each_child_node.to_a
|
146
|
+
end
|
147
|
+
|
132
148
|
# Calls the given block for each descendant node with depth first order.
|
133
149
|
# If no block is given, an `Enumerator` is returned.
|
134
150
|
#
|
@@ -161,6 +177,14 @@ module Astrolabe
|
|
161
177
|
self
|
162
178
|
end
|
163
179
|
|
180
|
+
# Returns an array of descendant nodes.
|
181
|
+
# This is a shorthand for `node.each_descendant.to_a`.
|
182
|
+
#
|
183
|
+
# @return [Array<Node>] an array of descendant nodes
|
184
|
+
def descendants
|
185
|
+
each_descendant.to_a
|
186
|
+
end
|
187
|
+
|
164
188
|
# Calls the given block for the receiver and each descendant node with depth first order.
|
165
189
|
# If no block is given, an `Enumerator` is returned.
|
166
190
|
#
|
data/lib/astrolabe/version.rb
CHANGED