ast 2.4.1 → 2.4.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ast/node.rb +10 -2
  3. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1ea61250ad8d285c9857cb70e2529f827b561b673b01dc02e92cc7bcea81094
4
- data.tar.gz: 88c407ffbff0293306bda599d2fe5146bb3504a389f2a69c2c43a8b5c2244446
3
+ metadata.gz: 8210d16488dff96abdba806c27ddc7d9640e737050096441ec93dcff222b624c
4
+ data.tar.gz: e01089e2ec37377bf49160eebd8a277c4f481877e9cdfc4af977d860e7b516f0
5
5
  SHA512:
6
- metadata.gz: dad932faea02614394a61c4075efb11a2932c6231f9cd11d59d8e7345d8f74d4e7602881fce0e77094017c137159466b92f13ebecaee17e4ee611a0091a3f17a
7
- data.tar.gz: 59ea82e96f376f3dc4805a66baa37e577dec80bcad6485ba3a4bc440b27d0ba31ca5d789ca74e7594758f7cfbd279bc75195da8073af17b817e91f714192e874
6
+ metadata.gz: dc8e13d06da136e8de38ce6446f9260b35a1dbde3da47b558a256827df93a5d1bfa1130b07bc4fc326a0ac96dbdd112b330ec4b79a47cff647f7b48182803b65
7
+ data.tar.gz: 6afd93b25aa0d9061fdee5cebdd732303535107ecab668cc8dc37a49a0ee209d0906a9b8a415e1d4b62d4a5fd2b0f7da3263665a156aa9a57c24dd2f5ad89075
@@ -229,9 +229,9 @@ module AST
229
229
  def to_ast
230
230
  self
231
231
  end
232
-
232
+
233
233
  # Converts `self` to an Array where the first element is the type as a Symbol,
234
- # and subsequent elements are the same representation of its children.
234
+ # and subsequent elements are the same representation of its children.
235
235
  #
236
236
  # @return [Array<Symbol, [...Array]>]
237
237
  def to_sexp_array
@@ -246,6 +246,14 @@ module AST
246
246
  [type, *children_sexp_arrs]
247
247
  end
248
248
 
249
+ # Enables matching for Node, where type is the first element
250
+ # and the children are remaining items.
251
+ #
252
+ # @return [Array]
253
+ def deconstruct
254
+ [type, *children]
255
+ end
256
+
249
257
  protected
250
258
 
251
259
  # Returns `@type` with all underscores replaced by dashes. This allows
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ast
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.1
4
+ version: 2.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - whitequark
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-10 00:00:00.000000000 Z
11
+ date: 2021-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -126,7 +126,7 @@ homepage: https://whitequark.github.io/ast/
126
126
  licenses:
127
127
  - MIT
128
128
  metadata: {}
129
- post_install_message:
129
+ post_install_message:
130
130
  rdoc_options: []
131
131
  require_paths:
132
132
  - lib
@@ -141,8 +141,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubygems_version: 3.1.2
145
- signing_key:
144
+ rubygems_version: 3.2.3
145
+ signing_key:
146
146
  specification_version: 4
147
147
  summary: A library for working with Abstract Syntax Trees.
148
148
  test_files: []