ast 2.4.1 → 2.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ast/node.rb +10 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8210d16488dff96abdba806c27ddc7d9640e737050096441ec93dcff222b624c
|
4
|
+
data.tar.gz: e01089e2ec37377bf49160eebd8a277c4f481877e9cdfc4af977d860e7b516f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc8e13d06da136e8de38ce6446f9260b35a1dbde3da47b558a256827df93a5d1bfa1130b07bc4fc326a0ac96dbdd112b330ec4b79a47cff647f7b48182803b65
|
7
|
+
data.tar.gz: 6afd93b25aa0d9061fdee5cebdd732303535107ecab668cc8dc37a49a0ee209d0906a9b8a415e1d4b62d4a5fd2b0f7da3263665a156aa9a57c24dd2f5ad89075
|
data/lib/ast/node.rb
CHANGED
@@ -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.
|
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:
|
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.
|
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: []
|