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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a28137bbfc6aa56808d82dff61bfe690e6f71224
4
- data.tar.gz: 76042c7c0acf00dbe75f8d98560c9772de6fd5a4
3
+ metadata.gz: 0261eb0ca33d240e771b36abd56920b8434a4fb7
4
+ data.tar.gz: 427cba57b3afdc25097c51554c98a3f7177214b3
5
5
  SHA512:
6
- metadata.gz: ac99d9770aa746cde80dbd66ff99a5c270f5ca58838038073a2f6cc6078d17c4a56dada5a5692d68c0fa6e38cc146e92ba1a080adf7364d3aa6f95717b2a0272
7
- data.tar.gz: aa622bce276f4f8f2021c855be9ecb85781c1d018146af2bfaf4e376be6b35c20befedfaea3c20dbe3e52546b8c7a66f9b46a882508ef67e182e5d48ff32b38f
6
+ metadata.gz: c6372f0ce3b7208e01c1308061dbc50474fadeff0f4e6eafaece7f52b4661d35a81715bea5b3e758bce5ad508ff3450552077b3c6361e134d2ef9e0b17c5b89f
7
+ data.tar.gz: 275c1ce0a24de0ec1e28a7805b5939502ded932ed37c054f985f2760cff9169e4438761293429eedee709fbc1dda3e9395493f39695995ef690f1a3ff631c9b6
data/.rubocop.yml CHANGED
@@ -27,3 +27,7 @@ AlignHash:
27
27
  # a: 0
28
28
  # bb: 1
29
29
  EnforcedColonStyle: separator
30
+
31
+ RegexpLiteral:
32
+ Exclude:
33
+ - Guardfile
data/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Development
4
4
 
5
+ * Add `Node#ancestors`, `Node#child_nodes` and `Node#descendants` which return an array instead of enumerator.
6
+
5
7
  ## v1.0.0
6
8
 
7
9
  * Initial API stable release in the Semantic Versioning.
@@ -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
  #
@@ -5,7 +5,7 @@ module Astrolabe
5
5
  # http://semver.org/
6
6
  module Version
7
7
  MAJOR = 1
8
- MINOR = 0
8
+ MINOR = 1
9
9
  PATCH = 0
10
10
 
11
11
  def self.to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: astrolabe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Nakayama