decode 0.18.0 → 0.18.1
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
- checksums.yaml.gz.sig +0 -0
- data/lib/decode/language/ruby/class.rb +32 -2
- data/lib/decode/language/ruby/parser.rb +21 -10
- data/lib/decode/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6161432dca8cff543a44aa7077863081acc65e2c30ae5a71a6cee66c8c0ff1fa
|
4
|
+
data.tar.gz: 6881ade662a2414f923631ff5e34a90c4df6adf7501f9b973fad2a74fc231f74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f3b92e010e0d756e1462702efaef891f148ac804f2aaf9c3df4cd9f5e8a2fc5957c68fe2a9013bef25643805ff30c9c4501c66d2580d43026f5a4fe025ee277
|
7
|
+
data.tar.gz: 4bfbb2545dba5f1921c5a222bbd7fddb895a7fe29418b5280573a26a82814dee387b3377bfe6738d493059735d7a7ae444a51e3b0a8f0106166aa706b9cc2697
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -69,6 +69,10 @@ module Decode
|
|
69
69
|
|
70
70
|
# A Ruby-specific singleton class.
|
71
71
|
class Singleton < Definition
|
72
|
+
def nested_name
|
73
|
+
"::class"
|
74
|
+
end
|
75
|
+
|
72
76
|
# A singleton class is a container for other definitions.
|
73
77
|
# @returns [Boolean]
|
74
78
|
def container?
|
@@ -82,14 +86,40 @@ module Decode
|
|
82
86
|
end
|
83
87
|
|
84
88
|
# The short form of the class.
|
85
|
-
# e.g. `class <<
|
89
|
+
# e.g. `class << self`.
|
86
90
|
def short_form
|
87
91
|
"class << #{@name}"
|
88
92
|
end
|
89
93
|
|
90
94
|
# The long form is the same as the short form.
|
91
95
|
alias long_form short_form
|
96
|
+
|
97
|
+
def path_name
|
98
|
+
[:class]
|
99
|
+
end
|
100
|
+
|
101
|
+
# The lexical scope as an array of names.
|
102
|
+
# e.g. `[:Decode, :Definition]`
|
103
|
+
# @returns [Array]
|
104
|
+
def path
|
105
|
+
if @path
|
106
|
+
# Cached version:
|
107
|
+
@path
|
108
|
+
else
|
109
|
+
@path = [*self.absolute_path, *self.path_name]
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
def absolute_path
|
116
|
+
if @parent
|
117
|
+
@parent.path
|
118
|
+
else
|
119
|
+
@name.to_s.split('::').map(&:to_sym)
|
120
|
+
end
|
121
|
+
end
|
92
122
|
end
|
93
123
|
end
|
94
124
|
end
|
95
|
-
end
|
125
|
+
end
|
@@ -119,16 +119,18 @@ module Decode
|
|
119
119
|
walk_definitions(children, comments, definition, &block)
|
120
120
|
end
|
121
121
|
when :sclass
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
122
|
+
if name = singleton_name_for(node.children[0])
|
123
|
+
definition = Singleton.new(
|
124
|
+
node, name,
|
125
|
+
comments: extract_comments_for(node, comments),
|
126
|
+
parent: parent, language: @language
|
127
|
+
)
|
128
|
+
|
129
|
+
yield definition
|
130
|
+
|
131
|
+
if children = node.children[1]
|
132
|
+
walk_definitions(children, comments, definition, &block)
|
133
|
+
end
|
132
134
|
end
|
133
135
|
when :def
|
134
136
|
definition = Method.new(
|
@@ -229,6 +231,15 @@ module Decode
|
|
229
231
|
end
|
230
232
|
end
|
231
233
|
|
234
|
+
def singleton_name_for(node)
|
235
|
+
case node.type
|
236
|
+
when :const
|
237
|
+
nested_name_for(node)
|
238
|
+
when :self
|
239
|
+
:'self'
|
240
|
+
end
|
241
|
+
end
|
242
|
+
|
232
243
|
KIND_ATTRIBUTE = /\A
|
233
244
|
(@(?<kind>attribute)\s+(?<value>.*?))|
|
234
245
|
(@define\s+(?<kind>)\s+(?<value>.*?))
|
data/lib/decode/version.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -36,7 +36,7 @@ cert_chain:
|
|
36
36
|
RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
|
37
37
|
HiLJ8VOFx6w=
|
38
38
|
-----END CERTIFICATE-----
|
39
|
-
date: 2022-
|
39
|
+
date: 2022-07-08 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: parser
|
metadata.gz.sig
CHANGED
Binary file
|