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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1ca1745dcb76b54a61777388aba926d1262967dc51ca7ad633debc369f67d9f
4
- data.tar.gz: 4164ca61971b6573b8604767cfdf35766605893f8d63cba44a516d705c0d5093
3
+ metadata.gz: 813979836080a611db0650430359874b554250326fc391d453405b01a6137fc5
4
+ data.tar.gz: a0335e5e13a888f0b19a06f3010063bf840be1cf399134e37d112dcdba98dd9b
5
5
  SHA512:
6
- metadata.gz: 7b247bcd2d6b0eaacf1bbaa444cd98df314251bca958914793ad455521c9f379233f737e6afeeb31197b76f0ce9876de1887304203eb5487fda113fa4b8eea11
7
- data.tar.gz: 72b714cf3ad9b0f7969e23be899ca10186994661d6dbc0bb91bd27a200a6ce4ee18815bca5a7cc355316ea5f53b6ed2d818073b28f61a41caca0dbbf52196623
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
+ [![Development](https://github.com/ioquatix/decode/workflows/Development/badge.svg)](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-wiki'
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
@@ -1,5 +1,3 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
-
5
- gem 'utopia-project', path: '../../socketry/utopia-project'
@@ -57,6 +57,13 @@ module Decode
57
57
  self.long_form
58
58
  end
59
59
 
60
+ # Whether the definition spans multiple lines.
61
+ #
62
+ # @return [Boolean]
63
+ def multiline?
64
+ false
65
+ end
66
+
60
67
  # The full text of the definition.
61
68
  #
62
69
  # @return [String | nil]
@@ -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 documenation with an array of comments, within a specific language.
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.source
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
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Decode
22
- VERSION = "0.8.0"
22
+ VERSION = "0.9.0"
23
23
  end
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.8.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-04 00:00:00.000000000 Z
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-wiki
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