decode 0.8.0 → 0.9.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 +4 -4
- data/README.md +7 -1
- data/decode.gemspec +1 -1
- data/gems.rb +0 -2
- data/{examples/decode-index → guides/extract-symbols}/extract.rb +0 -0
- data/lib/decode/definition.rb +7 -0
- data/lib/decode/documentation.rb +1 -1
- data/lib/decode/language/ruby/definition.rb +16 -1
- data/lib/decode/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 813979836080a611db0650430359874b554250326fc391d453405b01a6137fc5
|
4
|
+
data.tar.gz: a0335e5e13a888f0b19a06f3010063bf840be1cf399134e37d112dcdba98dd9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f155904d306e546b857cca49e8ef25590de20253febff28f82a390ee6dd09e5bd412a5966578f4cf419848bc7282a34c64d1b8c98ce9ce28f6a92a821c46b298
|
7
|
+
data.tar.gz: 3e65b213a410b83b48dc30e1a89f49f5a013b0eeb414bd41d91510d9069921b95f7bfb74195b011ab42c1c7dc6c8ddb53935f40bdf97d068e2c3d8a79b07f5b1
|
data/README.md
CHANGED
@@ -2,9 +2,15 @@
|
|
2
2
|
|
3
3
|
A Ruby code analysis tool and documentation generator.
|
4
4
|
|
5
|
+
[](https://github.com/ioquatix/decode/actions?workflow=Development)
|
6
|
+
|
7
|
+
## Motivation
|
8
|
+
|
9
|
+
As part of my effort to build [better project documentation](https://github.com/socketry/utopia-project), I needed a better code analysis tool. While less featured than some of the more mature alternatives, this library focuses on the needs of documentation generation, including speed, cross-referencing and (eventually) multi-language support.
|
10
|
+
|
5
11
|
## Usage
|
6
12
|
|
7
|
-
Please see the <a href="https://ioquatix.github.io/decode">project documentation</a> or run it locally using `bake utopia:project:serve`.
|
13
|
+
Please see the <a href="https://ioquatix.github.io/decode/">project documentation</a> or run it locally using `bake utopia:project:serve`.
|
8
14
|
|
9
15
|
## Contributing
|
10
16
|
|
data/decode.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.add_development_dependency 'build-files'
|
28
28
|
spec.add_development_dependency 'bake-bundler'
|
29
|
-
spec.add_development_dependency 'utopia-
|
29
|
+
spec.add_development_dependency 'utopia-project'
|
30
30
|
spec.add_development_dependency 'covered'
|
31
31
|
spec.add_development_dependency 'bundler'
|
32
32
|
spec.add_development_dependency 'rspec'
|
data/gems.rb
CHANGED
File without changes
|
data/lib/decode/definition.rb
CHANGED
data/lib/decode/documentation.rb
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
module Decode
|
22
22
|
# Structured access to a set of comment lines.
|
23
23
|
class Documentation
|
24
|
-
# Initialize the
|
24
|
+
# Initialize the documentation with an array of comments, within a specific language.
|
25
25
|
#
|
26
26
|
# @param comments [Array(String)] An array of comment lines.
|
27
27
|
# @param language [Language] The language in which the comments were extracted.
|
@@ -35,10 +35,25 @@ module Decode
|
|
35
35
|
# The parser syntax tree node.
|
36
36
|
attr :node
|
37
37
|
|
38
|
+
def multiline?
|
39
|
+
@node.location.line != @node.location.last_line
|
40
|
+
end
|
41
|
+
|
38
42
|
# The source code associated with the definition.
|
39
43
|
# @return [String]
|
40
44
|
def text
|
41
|
-
@node.location.expression
|
45
|
+
expression = @node.location.expression
|
46
|
+
lines = expression.source.lines
|
47
|
+
if lines.count == 1
|
48
|
+
return lines.first
|
49
|
+
else
|
50
|
+
indentation = expression.source_line[/\A\s+/]
|
51
|
+
|
52
|
+
# Remove all the indentation:
|
53
|
+
lines.each{|line| line.sub!(indentation, '')}
|
54
|
+
|
55
|
+
return lines.join
|
56
|
+
end
|
42
57
|
end
|
43
58
|
end
|
44
59
|
end
|
data/lib/decode/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: utopia-
|
56
|
+
name: utopia-project
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -120,8 +120,8 @@ files:
|
|
120
120
|
- ".rspec"
|
121
121
|
- README.md
|
122
122
|
- decode.gemspec
|
123
|
-
- examples/decode-index/extract.rb
|
124
123
|
- gems.rb
|
124
|
+
- guides/extract-symbols/extract.rb
|
125
125
|
- lib/decode.rb
|
126
126
|
- lib/decode/definition.rb
|
127
127
|
- lib/decode/documentation.rb
|