decode 0.17.2 → 0.17.3

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
  SHA256:
3
- metadata.gz: c7d6009f4ff23fb9cceecfe8d661848867bfd1528f31fa99a45aa52f7fb5d4f8
4
- data.tar.gz: d9ddb59b516d3b8306ff6dc6dddbc1263c9761e1ae4a2cf187040442f6865299
3
+ metadata.gz: a838fd5f42db321e8afe7627740faca8a0bce85e66016b1a9f5eac4c1b800e13
4
+ data.tar.gz: 2d2e88c8dfbddaf2507f8b94ef7b3678247640ff48768dd8971afe4bca32a579
5
5
  SHA512:
6
- metadata.gz: 592f7031ec864569dad6001f919e65990cea614278ad12f3479491df39a422b4c0a3f9f7dcc197b6c03d113fee8438e6606b1a624343ac0ae4ea76f36a43a792
7
- data.tar.gz: 561e6b926e5b3ab9ef258b0fe915d4758f64514f1512a6f5f2b155327e601bf10022a819d7b307ffa4e31a8884d7635fdc5fd40606deb6f5c775835cd0b6f423
6
+ metadata.gz: 2fd7f4dc09a37c14d87750e3cf12ed22f6352877a382ab6a08f8571b48d774761fa2deb6dcc7382bb43868361774816d018c086f3ae2e0b0908a89c8e9704154
7
+ data.tar.gz: e6b60875db3b53417736599852a9354eabbdc08503b3dda594bd364df7c98fa84702303917f27c7850054ab40d0f5c25b018a0a9919bf07a9e7d922cd8b480fb
checksums.yaml.gz.sig CHANGED
Binary file
@@ -97,13 +97,17 @@ module Decode
97
97
  @path
98
98
  elsif @parent
99
99
  # Merge with parent:
100
- @path = [*@parent.path, @name].freeze
100
+ @path = [*@parent.path, *path_name].freeze
101
101
  else
102
102
  # At top:
103
- @path = [@name].freeze
103
+ @path = path_name.freeze
104
104
  end
105
105
  end
106
106
 
107
+ def path_name
108
+ [@name]
109
+ end
110
+
107
111
  alias lexical_path path
108
112
 
109
113
  # A short form of the definition.
data/lib/decode/index.rb CHANGED
@@ -51,7 +51,6 @@ module Decode
51
51
 
52
52
  # A (prefix) trie of lexically scoped definitions.
53
53
  # @attribute [Trie]
54
-
55
54
  attr :trie
56
55
 
57
56
  # Updates the index by parsing the specified files.
@@ -37,18 +37,22 @@ module Decode
37
37
  # The short form of the class.
38
38
  # e.g. `class Animal`.
39
39
  def short_form
40
- "class #{@name}"
40
+ "class #{path_name.last}"
41
41
  end
42
42
 
43
43
  # The long form of the class.
44
44
  # e.g. `class Dog < Animal`.
45
45
  def long_form
46
- if super_node = @node.children[1]
47
- @node.location.keyword.join(
48
- super_node.location.expression
49
- ).source
46
+ if super_class = self.super_class
47
+ "#{qualified_form} < #{super_class}"
50
48
  else
51
- self.short_form
49
+ qualified_form
50
+ end
51
+ end
52
+
53
+ def super_class
54
+ if super_node = @node.children[1]
55
+ super_node.location.expression.source
52
56
  end
53
57
  end
54
58
 
@@ -57,6 +61,10 @@ module Decode
57
61
  def qualified_form
58
62
  "class #{self.qualified_name}"
59
63
  end
64
+
65
+ def path_name
66
+ @name.to_s.split('::').map(&:to_sym)
67
+ end
60
68
  end
61
69
 
62
70
  # A Ruby-specific singleton class.
@@ -37,17 +37,22 @@ module Decode
37
37
  # The short form of the module.
38
38
  # e.g. `module Barnyard`.
39
39
  def short_form
40
- "module #{@name}"
40
+ "module #{path_name.last}"
41
41
  end
42
42
 
43
- # The long form is the same as the short form.
44
- alias long_form short_form
43
+ def long_form
44
+ qualified_form
45
+ end
45
46
 
46
47
  # The fully qualified name of the class.
47
48
  # e.g. `module ::Barnyard::Dog`.
48
49
  def qualified_form
49
50
  "module #{self.qualified_name}"
50
51
  end
52
+
53
+ def path_name
54
+ @name.to_s.split('::').map(&:to_sym)
55
+ end
51
56
  end
52
57
  end
53
58
  end
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Decode
22
- VERSION = "0.17.2"
22
+ VERSION = "0.17.3"
23
23
  end
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.17.2
4
+ version: 0.17.3
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: 2021-12-16 00:00:00.000000000 Z
39
+ date: 2022-05-13 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: parser
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  - !ruby/object:Gem::Version
178
178
  version: '0'
179
179
  requirements: []
180
- rubygems_version: 3.2.32
180
+ rubygems_version: 3.3.7
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: Code analysis for documentation generation.
metadata.gz.sig CHANGED
Binary file